Re: [RFC][PATCH] net drivers and cache alignment

From: Jeff Garzik (jgarzik@pobox.com)
Date: Sat Dec 07 2002 - 18:42:57 EST


J.A. Magallon wrote:
> On 2002.12.08 Andrew Morton wrote:
>
>>Jeff Garzik wrote:
>>
>>>David S. Miller wrote:
>>>
>>>>Can't the cacheline_aligned attribute be applied to individual
>>>>struct members? I remember doing this for thread_struct on
>>>>sparc ages ago.
>>>
>>>Looks like it from the 2.4 processor.h code.
>>>
>>>Attached is cut #2. Thanks for all the near-instant feedback so far :)
>>> Andrew, does the attached still need padding on SMP?
>>
>
> What do you all think about this:
>
> #include <stdio.h>
>
> #define CACHE_LINE_SIZE 128
> #define ____cacheline_aligned __attribute__((__aligned__(CACHE_LINE_SIZE)))
>
> #define __cacheline_start struct { } ____cacheline_aligned;

if you can mark struct members with attributes, as it appears you can,
there's no need to define a struct.

        Jeff

-
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 : Sat Dec 07 2002 - 22:00:31 EST