Re: [PATCH] perfcounters: fix type/event_id layout on big-endiansystems

From: Ingo Molnar
Date: Sat Mar 21 2009 - 05:43:27 EST



* Paul Mackerras <paulus@xxxxxxxxx> wrote:

> struct perf_counter_hw_event {
> union {
> +#ifndef __BIG_ENDIAN_BITFIELD
> struct {
> __u64 event_id : 56,
> type : 8;
> @@ -94,6 +96,16 @@ struct perf_counter_hw_event {
> __u64 raw_event_id : 63,
> raw_type : 1;
> };
> +#else
> + struct {
> + __u64 type : 8,
> + event_id : 56;
> + };
> + struct {
> + __u64 raw_type : 1,
> + raw_event_id : 63;
> + };
> +#endif /* __BIT_ENDIAN_BITFIELD */

hm, this ifdef really looks ugly. How about just changing event_id
to 64 bits and having a separate u32 type field? The size impact is
minimal, the cleanliness win is significant :-)

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/