Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751987AbdHDJUt (ORCPT ); Fri, 4 Aug 2017 05:20:49 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:58290 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751285AbdHDJUs (ORCPT ); Fri, 4 Aug 2017 05:20:48 -0400 Date: Fri, 4 Aug 2017 11:20:39 +0200 From: Peter Zijlstra To: "Huang, Ying" Cc: Eric Dumazet , linux-kernel@vger.kernel.org, Ingo Molnar , Michael Ellerman , Borislav Petkov , Thomas Gleixner , Juergen Gross , Aaron Lu Subject: Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data Message-ID: <20170804092039.ezsxko32a6n5ra4v@hirez.programming.kicks-ass.net> References: <20170802085220.4315-1-ying.huang@intel.com> <20170802085220.4315-4-ying.huang@intel.com> <1501669138.25002.20.camel@edumazet-glaptop3.roam.corp.google.com> <87d18d122e.fsf@yhuang-dev.intel.com> <20170803085752.yrqox3kwrvkj544a@hirez.programming.kicks-ass.net> <87wp6kyvda.fsf@yhuang-dev.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wp6kyvda.fsf@yhuang-dev.intel.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1040 Lines: 30 On Fri, Aug 04, 2017 at 09:28:17AM +0800, Huang, Ying wrote: > Peter Zijlstra 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 > > > > 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.