Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751968AbdHDCF7 (ORCPT ); Thu, 3 Aug 2017 22:05:59 -0400 Received: from mga03.intel.com ([134.134.136.65]:19931 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751231AbdHDCF6 (ORCPT ); Thu, 3 Aug 2017 22:05:58 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,319,1498546800"; d="scan'208";a="119550550" From: "Huang\, Ying" To: "Huang\, Ying" Cc: Peter Zijlstra , 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> Date: Fri, 04 Aug 2017 10:05:55 +0800 In-Reply-To: <87wp6kyvda.fsf@yhuang-dev.intel.com> (Ying Huang's message of "Fri, 4 Aug 2017 09:28:17 +0800") Message-ID: <87mv7gytmk.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (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 Content-Length: 1271 Lines: 45 "Huang, Ying" writes: > 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. 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)); Best Regards, Huang, Ying > Best Regards, > Huang, Ying > >> /* total number of cpus in this system (may exceed NR_CPUS) */ >> extern unsigned int total_cpus; >> > [snip]