From: Andrew Morton <akpm@osdl.org>
To: Martin Peschke <mp3@de.ibm.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [Patch 1/2] CPU hotplug compatible alloc_percpu
Date: Tue, 25 Jul 2006 23:02:59 -0700 [thread overview]
Message-ID: <20060725230259.f5a27306.akpm@osdl.org> (raw)
In-Reply-To: <1153761414.2986.136.camel@dyn-9-152-230-71.boeblingen.de.ibm.com>
On Mon, 24 Jul 2006 19:16:54 +0200
Martin Peschke <mp3@de.ibm.com> wrote:
> This patch splits alloc_percpu() up into two phases. Likewise for
> free_percpu(). This allows clients to limit initial allocations to
> online cpu's, and to populate or depopulate per-cpu data at run time as
> needed:
>
> struct my_struct *obj;
>
> /* initial allocation for online cpu's */
> obj = percpu_alloc(sizeof(struct my_struct), GFP_KERNEL);
>
> ...
>
> /* populate per-cpu data for cpu coming online */
> ptr = percpu_populate(obj, sizeof(struct my_struct), GFP_KERNEL, cpu);
>
> ...
>
> /* access per-cpu object */
> ptr = percpu_ptr(obj, smp_processor_id());
>
> ...
>
> /* depopulate per-cpu data for cpu going offline */
> percpu_depopulate(obj, cpu);
>
> ...
>
> /* final removal */
> percpu_free(obj);
That looks pretty thorough.
The one little nit I'd have is that the code passes cpumasks by value. See
the tricks in <linux/cpumask.h> which pretend to take the caller's cpumask
by value but which instead pass it via const reference to the callee.
CONFIG_NR_CPUS=1024 leads to a 128-byte cpumask_t. It's worth doing.
next prev parent reply other threads:[~2006-07-26 6:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-24 17:16 Martin Peschke
2006-07-26 6:02 ` Andrew Morton [this message]
2006-07-28 6:20 ` Martin Peschke
2006-07-27 16:18 ` Paul Jackson
2006-07-28 6:15 ` Martin Peschke
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=20060725230259.f5a27306.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mp3@de.ibm.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
Powered by JetHome