linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Huang\, Ying" <ying.huang@intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Huang\, Ying" <ying.huang@intel.com>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	<linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@kernel.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Borislav Petkov <bp@suse.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Juergen Gross" <jgross@suse.com>, Aaron Lu <aaron.lu@intel.com>
Subject: Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data
Date: Sat, 05 Aug 2017 08:47:02 +0800	[thread overview]
Message-ID: <87d18alu2h.fsf@yhuang-mobile.sh.intel.com> (raw)
In-Reply-To: <20170804092754.hyhbhyr2r4gonpu4@hirez.programming.kicks-ass.net> (Peter Zijlstra's message of "Fri, 4 Aug 2017 11:27:54 +0200")

Peter Zijlstra <peterz@infradead.org> writes:

> On Fri, Aug 04, 2017 at 10:05:55AM +0800, Huang, Ying wrote:
>> "Huang, Ying" <ying.huang@intel.com> writes:
>> > Peter Zijlstra <peterz@infradead.org> 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

  reply	other threads:[~2017-08-05  0:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02  8:52 [PATCH 0/3] IPI: Avoid to use 2 cache lines for one call_single_data Huang, Ying
2017-08-02  8:52 ` [PATCH 1/3] percpu: Add alloc_percpu_aligned() Huang, Ying
2017-08-02 13:50   ` Christopher Lameter
2017-08-03  0:33     ` Huang, Ying
2017-08-02  8:52 ` [PATCH 2/3] iova: Use alloc_percpu_aligned() Huang, Ying
2017-08-02  8:52 ` [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data Huang, Ying
2017-08-02 10:18   ` Eric Dumazet
2017-08-02 10:53     ` Peter Zijlstra
2017-08-03  8:35     ` Huang, Ying
2017-08-03  8:57       ` Peter Zijlstra
2017-08-04  1:28         ` Huang, Ying
2017-08-04  2:05           ` Huang, Ying
2017-08-04  9:27             ` Peter Zijlstra
2017-08-05  0:47               ` Huang, Ying [this message]
2017-08-07  8:28                 ` Peter Zijlstra
2017-08-08  4:30                   ` Huang, Ying
2017-08-14  5:44                     ` Huang, Ying
2017-08-28  5:19                       ` Huang, Ying
2017-08-28  8:49                         ` Peter Zijlstra
2017-08-29 14:23                     ` [tip:locking/core] smp: Avoid using two cache lines for struct call_single_data tip-bot for Ying Huang
2017-08-04  9:20           ` [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data Peter Zijlstra
2017-08-02 13:54 ` [PATCH 0/3] " Christopher Lameter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d18alu2h.fsf@yhuang-mobile.sh.intel.com \
    --to=ying.huang@intel.com \
    --cc=aaron.lu@intel.com \
    --cc=bp@suse.de \
    --cc=eric.dumazet@gmail.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).