Re: Pls apply this spinlock patch to the kernel

From: Richard Henderson (rth@twiddle.net)
Date: Sat Nov 03 2001 - 16:01:56 EST


On Sat, Nov 03, 2001 at 12:20:53PM -0800, Linus Torvalds wrote:
> If you have a 4-byte entry that is aligned to 128 bytes, you have 124
> bytes of stuff that the linker _will_ fill up with other things.

If you put the alignment on the type, not the variable, e.g.

  typedef int aligned_int __attribute__((aligned(128)));
  aligned_int foo;

then sizeof(foo) == 128, and the linker sees a 128-byte object,
not a 4 byte object with 128 byte alignment.

It's a subtle difference between alignment of types and alignment
of variables, but it makes sense if you think about it.

r~
-
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/



This archive was generated by hypermail 2b29 : Wed Nov 07 2001 - 21:00:21 EST