From: "Huang\, Ying" <ying.huang@intel.com>
To: Christopher Lameter <cl@linux.com>
Cc: "Huang\, Ying" <ying.huang@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
<linux-kernel@vger.kernel.org>, Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH 1/3] percpu: Add alloc_percpu_aligned()
Date: Thu, 03 Aug 2017 08:33:22 +0800 [thread overview]
Message-ID: <87tw1p5w31.fsf@yhuang-dev.intel.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1708020847360.23703@nuc-kabylake> (Christopher Lameter's message of "Wed, 2 Aug 2017 08:50:44 -0500")
Christopher Lameter <cl@linux.com> writes:
> On Wed, 2 Aug 2017, Huang, Ying wrote:
>
>> --- a/include/linux/percpu.h
>> +++ b/include/linux/percpu.h
>> @@ -129,5 +129,8 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
>> #define alloc_percpu(type) \
>> (typeof(type) __percpu *)__alloc_percpu(sizeof(type), \
>> __alignof__(type))
>> +#define alloc_percpu_aligned(type) \
>> + ((typeof(type) __percpu *)__alloc_percpu(sizeof(type), \
>> + max_t(unsigned int, cache_line_size(), __alignof__(type))))
>>
>> #endif /* __LINUX_PERCPU_H */
>
> This is not needeed since alloc_percpu() already uses __alignof__(type).
>
> If you add an attribute to the definition of "type" that requires
> cacheline alignmet (f.e. __cacheline_aligned) then alloc_percpu() will
> align the allocation as you desire.
OK.
Best Regards,
Huang, Ying
next prev parent reply other threads:[~2017-08-03 0:33 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 [this message]
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
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=87tw1p5w31.fsf@yhuang-dev.intel.com \
--to=ying.huang@intel.com \
--cc=cl@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tj@kernel.org \
/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).