lkml.org 
[lkml]   [2017]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data
On Fri, Aug 04, 2017 at 09:28:17AM +0800, Huang, Ying wrote:
> Peter Zijlstra <peterz@infradead.org> writes:
> [snip]
> > diff --git a/include/linux/smp.h b/include/linux/smp.h
> > index 68123c1fe549..8d817cb80a38 100644
> > --- a/include/linux/smp.h
> > +++ b/include/linux/smp.h
> > @@ -14,13 +14,16 @@
> > #include <linux/llist.h>
> >
> > typedef void (*smp_call_func_t)(void *info);
> > -struct call_single_data {
> > +struct __call_single_data {
> > struct llist_node llist;
> > smp_call_func_t func;
> > void *info;
> > unsigned int flags;
> > };
> >
> > +typedef struct __call_single_data call_single_data_t
> > + __aligned(sizeof(struct __call_single_data));
> > +
>
> Another requirement of the alignment is that it should be the power of
> 2. Otherwise, for example, if someone adds a field to struct, so that
> the size becomes 40 on x86_64. The alignment should be 64 instead of
> 40.

Yes I know. This generates a compiler error if sizeof() isn't a
power of 2. That's similar to the BUILD_BUG_ON() you added.

\
 
 \ /
  Last update: 2017-08-04 11:21    [W:0.063 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site