From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Christoph Lameter <cl@linux-foundation.org>
Cc: Tejun Heo <tj@kernel.org>,
linux-kernel@vger.kernel.org, Mel Gorman <mel@csn.ul.ie>,
Pekka Enberg <penberg@cs.helsinki.fi>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [this_cpu_xx V7 0/8] Per cpu atomics in core allocators and cleanup
Date: Tue, 15 Dec 2009 12:43:02 -0500 [thread overview]
Message-ID: <20091215174302.GA3928@Krystal> (raw)
In-Reply-To: <20091214220320.665065925@quilx.com>
* Christoph Lameter (cl@linux-foundation.org) wrote:
> Leftovers from the earlier patchset. Mostly applications of per cpu counters
> to core components.
>
> After this patchset there will be only one user of local_t left: Mathieu's
> trace ringbuffer. Does it really need these ops?
>
Besides my own ring buffer implementation in LTTng, at least Steven's
kernel/trace/ring_buffer.c (in mainline) use this too. We would need a
way to directly map to the same resulting behavior with per-cpu
variables.
In LTTng, I use local_cmpxchg, local_read, local_add and, in some
setups, local_add_return to manage the write counter and commit
counters. These per-cpu counters are kept in per-cpu buffer management
data allocated for each data collection "channel".
The current way I allocate this structure for all cpus is:
chan->buf = alloc_percpu(struct ltt_chanbuf);
But note that each struct ltt_chanbuf contains a pointer to an array
containing each sub-buffer commit counters for the given buffer:
struct commit_counters {
local_t cc;
local_t cc_sb; /* Incremented _once_ at sb switch */
local_t events; /* Event count */
};
struct ltt_chanbuf {
struct ltt_chanbuf_alloc a; /* Parent. First field. */
/* First 32 bytes cache-hot cacheline */
local_t offset; /* Current offset in the buffer */
struct commit_counters *commit_count;
/* Commit count per sub-buffer */
atomic_long_t consumed; /*
* Current offset in the buffer
* standard atomic access (shared)
*/
....
So I think accessing the "local_t offset" through percpu pointers should
be fine if I allocate struct ltt_chanbuf through the per cpu API.
However, I wonder how to deal with the commit_count counters, because
there is an indirection level.
Thanks,
Mathieu
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
next prev parent reply other threads:[~2009-12-15 17:43 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-14 22:03 [this_cpu_xx V7 0/8] Per cpu atomics in core allocators and cleanup Christoph Lameter
2009-12-14 22:03 ` [this_cpu_xx V7 1/8] this_cpu_ops: page allocator conversion Christoph Lameter
2009-12-15 3:53 ` Tejun Heo
2009-12-15 15:04 ` Christoph Lameter
2009-12-16 0:53 ` Tejun Heo
2009-12-16 14:55 ` Christoph Lameter
2009-12-17 0:23 ` Tejun Heo
2009-12-14 22:03 ` [this_cpu_xx V7 2/8] this_cpu ops: Remove pageset_notifier Christoph Lameter
2009-12-14 22:03 ` [this_cpu_xx V7 3/8] Use this_cpu operations in slub Christoph Lameter
2009-12-14 22:03 ` [this_cpu_xx V7 4/8] SLUB: Get rid of dynamic DMA kmalloc cache allocation Christoph Lameter
2009-12-14 22:03 ` [this_cpu_xx V7 5/8] this_cpu: Remove slub kmem_cache fields Christoph Lameter
2009-12-14 22:03 ` [this_cpu_xx V7 6/8] Make slub statistics use this_cpu_inc Christoph Lameter
2009-12-15 6:24 ` Eric Dumazet
2009-12-15 14:46 ` Christoph Lameter
2009-12-15 14:59 ` Eric Dumazet
2009-12-14 22:03 ` [this_cpu_xx V7 7/8] Module handling: Use this_cpu_xx to dynamically allocate counters Christoph Lameter
2009-12-15 4:03 ` Tejun Heo
2009-12-15 22:41 ` Rusty Russell
2009-12-16 16:10 ` Christoph Lameter
2009-12-17 0:25 ` Tejun Heo
2009-12-17 5:42 ` Rusty Russell
2009-12-14 22:03 ` [this_cpu_xx V7 8/8] Remove cpu_local_xx macros Christoph Lameter
2009-12-15 4:04 ` Tejun Heo
2009-12-15 6:37 ` [this_cpu_xx V7 0/8] Per cpu atomics in core allocators and cleanup Pekka Enberg
2009-12-15 6:47 ` Tejun Heo
2009-12-15 14:50 ` Christoph Lameter
2009-12-15 17:06 ` Mel Gorman
2009-12-16 14:44 ` Christoph Lameter
2009-12-16 21:36 ` Christoph Lameter
2009-12-15 17:43 ` Mathieu Desnoyers [this message]
2009-12-16 0:58 ` Tejun Heo
2009-12-16 1:40 ` Mathieu Desnoyers
2009-12-16 1:46 ` Tejun Heo
2009-12-17 13:39 ` Mathieu Desnoyers
2009-12-17 19:28 ` Christoph Lameter
2009-12-17 20:25 ` Mathieu Desnoyers
2009-12-17 20:43 ` Christoph Lameter
2009-12-18 0:13 ` Mathieu Desnoyers
2009-12-18 0:27 ` Christoph 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=20091215174302.GA3928@Krystal \
--to=mathieu.desnoyers@polymtl.ca \
--cc=cl@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mel@csn.ul.ie \
--cc=penberg@cs.helsinki.fi \
--cc=rostedt@goodmis.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