From: Martin Peschke <mp3@de.ibm.com>
To: linux-kernel@vger.kernel.org
Subject: How to allocate per-cpu data for online CPUs only (and safely)?
Date: Tue, 21 Feb 2006 21:24:15 +0100 [thread overview]
Message-ID: <43FB76EF.9080406@de.ibm.com> (raw)
I am trying to optimize the memory footprint of some code of mine.
It's been using per-cpu data and alloc_percpu() so far. The latter has
the disadvantage of getting hold of memory for CPU's which aren't there
(yet).
I could imagine using CPU-hotplug notifications as triggers for
additional allocations or for cleaning up unneeded memory. But
alloc_percpu() appears to conflict with that idea.
I was briefly tempted to derive some code from alloc_percpu() more to my
liking, until I was scared off by this comment in alloc_percpu():
/*
* Cannot use for_each_online_cpu since a cpu may come online
* and we have no way of figuring out how to fix the array
* that we have allocated then....
*/
Well, and then there is kernel/profile.c, for example, which boldly
ignors alloc_percpu()'s qualms and allocates and releases per-cpu data
as needed.
Is that the way to go?
If so, why alloc_percpu()'s reservations?
Or, does that comment imply that the exploiter isn't expected to take
care of CPU hotplug events?
Am I missing anything?
Thank you.
Martin
next reply other threads:[~2006-02-21 20:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-21 20:24 Martin Peschke [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-02-21 22:29 How to allocate per-cpu data for online CPUs only (and safely)? Martin Peschke
2006-02-22 8:31 ` Srivatsa Vaddagiri
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=43FB76EF.9080406@de.ibm.com \
--to=mp3@de.ibm.com \
--cc=linux-kernel@vger.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