This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH] local_t : Documentation
- From: Pavel Machek <pavel at ucw dot cz>
- To: Andrew Morton <akpm at osdl dot org>
- Cc: Mathieu Desnoyers <mathieu dot desnoyers at polymtl dot ca>, linux-kernel at vger dot kernel dot org, Ingo Molnar <mingo at redhat dot com>, Greg Kroah-Hartman <gregkh at suse dot de>, Christoph Hellwig <hch at infradead dot org>, ltt-dev at shafik dot org, systemtap at sources dot redhat dot com, Douglas Niehaus <niehaus at eecs dot ku dot edu>, "Martin J. Bligh" <mbligh at mbligh dot org>, Thomas Gleixner <tglx at linutronix dot de>
- Date: Tue, 9 Jan 2007 23:38:26 +0100
- Subject: Re: [PATCH] local_t : Documentation
- References: <20061221001545.GP28643@Krystal> <20061223093358.GF3960@ucw.cz> <20070109031446.GA29426@Krystal> <20070109130110.8934c29f.akpm@osdl.org>
On Tue 2007-01-09 13:01:10, Andrew Morton wrote:
> On Mon, 8 Jan 2007 22:14:46 -0500
> Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
>
> > +* How to use local atomic operations
> > +
> > +#include <linux/percpu.h>
> > +#include <asm/local.h>
> > +
> > +static DEFINE_PER_CPU(local_t, counters) = LOCAL_INIT(0);
> > +
> > +
> > +* Counting
> > +
> > +In preemptible context, use get_cpu_var() and put_cpu_var() around local atomic
> > +operations : it makes sure that preemption is disabled around write access to
> > +the per cpu variable. For instance :
> > +
> > + local_inc(&get_cpu_var(counters));
> > + put_cpu_var(counters);
>
> Confused. The whole point behind local_t is that we can do
> atomic-wrt-interrupts inc and dec on them.
Could we get this short of two line description into the Doc/ file? It
talks about how to implement them, mentions LOCK prefixes unlikely to
be present on non-i386, but does not tell me what they guarantee...
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html