From: Christopher Lameter <cl@linux.com>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: 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: Wed, 2 Aug 2017 08:50:44 -0500 (CDT) [thread overview]
Message-ID: <alpine.DEB.2.20.1708020847360.23703@nuc-kabylake> (raw)
In-Reply-To: <20170802085220.4315-2-ying.huang@intel.com>
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.
next prev parent reply other threads:[~2017-08-02 13:51 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 [this message]
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
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=alpine.DEB.2.20.1708020847360.23703@nuc-kabylake \
--to=cl@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tj@kernel.org \
--cc=ying.huang@intel.com \
/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
all inboxes | Powered by JetHome®