From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752425AbdHEArI (ORCPT ); Fri, 4 Aug 2017 20:47:08 -0400 Received: from mga07.intel.com ([134.134.136.100]:61936 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751930AbdHEArG (ORCPT ); Fri, 4 Aug 2017 20:47:06 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,322,1498546800"; d="scan'208";a="115819559" From: "Huang\, Ying" To: Peter Zijlstra Cc: "Huang\, Ying" , Eric Dumazet , , 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 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> <87mv7gytmk.fsf@yhuang-dev.intel.com> <20170804092754.hyhbhyr2r4gonpu4@hirez.programming.kicks-ass.net> Date: Sat, 05 Aug 2017 08:47:02 +0800 In-Reply-To: <20170804092754.hyhbhyr2r4gonpu4@hirez.programming.kicks-ass.net> (Peter Zijlstra's message of "Fri, 4 Aug 2017 11:27:54 +0200") Message-ID: <87d18alu2h.fsf@yhuang-mobile.sh.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter Zijlstra writes: > On Fri, Aug 04, 2017 at 10:05:55AM +0800, Huang, Ying wrote: >> "Huang, Ying" writes: >> > Peter Zijlstra writes: > >> >> +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. >> >> Thanks Aaron, he reminded me that there is a roundup_pow_of_two(). So >> the typedef could be, >> >> typedef struct __call_single_data call_single_data_t >> __aligned(roundup_pow_of_two(sizeof(struct __call_single_data)); >> > > Yes, that would take away the requirement to play padding games with the > struct. Then again, maybe its a good thing to have to be explicit about > it. > > If you see: > > struct __call_single_data { > struct llist_node llist; > smp_call_func_t func; > void *info > int flags; > void *extra_field; > > unsigned long __padding[3]; /* make align work */ > }; > > that makes it very clear what is going on. In any case, we can delay > this part because the current structure is a power-of-2 for both ILP32 > and LP64. So only the person growing this will have to deal with it ;-) Yes. That looks good. So you will prepare the final patch? Or you hope me to do that? Best Regards, Huang, Ying