It needs padding _only_ on SMP. ____cacheline_aligned_in_smp.
#define offsetof(t, m) ((int)(&((t *)0)->m))
struct foo {
int a;
int b __attribute__((__aligned__(1024)));
int c;
} foo;
main()
{
printf("%d\n", sizeof(struct foo));
printf("%d\n", offsetof(struct foo, a));
printf("%d\n", offsetof(struct foo, b));
printf("%d\n", offsetof(struct foo, c));
}
./a.out
2048
0
1024
1028
So your patch will do what you want it to do. You should just tag the
first member of a group with ____cacheline_aligned_in_smp, and keep an
eye on things with offsetof().
Not sure why sizeof() returned 2048 though.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/