From: Rusty Russell <rusty@rustcorp.com.au>
To: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <jens.axboe@oracle.com>,
Jerome Marchand <jmarchan@redhat.com>,
linux-kernel@vger.kernel.org,
Christoph Lameter <cl@linux-foundation.org>,
Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Subject: Re: per-cpu stats in block device: overkill?
Date: Mon, 22 Dec 2008 14:26:09 +1030 [thread overview]
Message-ID: <200812221426.09723.rusty@rustcorp.com.au> (raw)
In-Reply-To: <494EF3AA.9040100@kernel.org>
On Monday 22 December 2008 12:25:54 Tejun Heo wrote:
> I'm working on local counter (local_t) allocator which is used to
> replace percpu allocation in percpu_counter and used as basis for
> percpu_ref which replaces module ref counting and will be used to
> simplify block/char lifetime rules.
Hi Tejun,
Interesting! Thanks to Christoph's dynamic percpu efforts, I've
been revising efforts to make alloc_percpu use the same efficient
mechanism that static percpu vars use. We actually have this code
already, tucked away in module.c.
This work is basically complete; the step I started this morning
is to remove the per_cpu__ prefix hackery from the per-cpu ops (in favour
of sparse annotations). This leads to cpu_local_inc et. al. being usable
for alloc_percpu-created percpu vars, not just static ones.
> The local counter allocator allocates per-cpu pages and the space
> overhead is minimal. If per-cpu stats in genhd is necessary, I think
> converting it to percpu local counter allocation should do it.
Interesting; an allyesconfig boot uses 194 per-cpu allocs from
lib/percpu_counter.c at the moment. The module.c allocator is fairly space
efficient: 4 bytes per "block" (ie. each allocation or hole) but slow,
which I figure is OK. Packing is good though.
> BTW, why make percpu area static?
Good question. Archs use a simple offset for per-cpu areas: some hold
this in a register (eg. %fs for x86-32). This means that the layout must be
"congruent" (ie. have the same inter-cpu spacing) if we allocate a new
per-cpu area (hard for non-NUMA).
For 5 years I waited for this to be fixed, and avoided exposing the per-cpu
core, and the alloc_percpu stuff was a standin implementation. But Christoph
L. showed that even with the size limit, there are numerous places which want
small per-cpu allocations which are optimally accessed, so I restarted work.
See Message-Id: <20081117132630.33F09DDDF5@ozlabs.org> "[PATCH 1/7] Improve
alloc_percpu: make the per cpu reserve configurable and larger." and thread.
In addition, Mathieu and I have been discussing local_t: it's wandered
off its original purpose and we're debating what to do about it. See
Message-ID: <alpine.DEB.1.10.0812150823370.18692@gandalf.stny.rr.com>
"local_add_return" and thread.
I look forward to always-cogent your thoughts on these issues!
Rusty.
prev parent reply other threads:[~2008-12-22 3:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-22 0:19 per-cpu stats in block device: overkill? Rusty Russell
2008-12-22 1:55 ` Tejun Heo
2008-12-22 3:56 ` Rusty Russell [this message]
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=200812221426.09723.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=cl@linux-foundation.org \
--cc=jens.axboe@oracle.com \
--cc=jmarchan@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
--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