Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932463AbXAIWik (ORCPT ); Tue, 9 Jan 2007 17:38:40 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932472AbXAIWik (ORCPT ); Tue, 9 Jan 2007 17:38:40 -0500 Received: from gprs189-60.eurotel.cz ([160.218.189.60]:34930 "EHLO amd.ucw.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932463AbXAIWij (ORCPT ); Tue, 9 Jan 2007 17:38:39 -0500 Date: Tue, 9 Jan 2007 23:38:26 +0100 From: Pavel Machek To: Andrew Morton Cc: Mathieu Desnoyers , linux-kernel@vger.kernel.org, Ingo Molnar , Greg Kroah-Hartman , Christoph Hellwig , ltt-dev@shafik.org, systemtap@sources.redhat.com, Douglas Niehaus , "Martin J. Bligh" , Thomas Gleixner Subject: Re: [PATCH] local_t : Documentation Message-ID: <20070109223826.GA6555@elf.ucw.cz> References: <20061221001545.GP28643@Krystal> <20061223093358.GF3960@ucw.cz> <20070109031446.GA29426@Krystal> <20070109130110.8934c29f.akpm@osdl.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070109130110.8934c29f.akpm@osdl.org> X-Warning: Reading this can be dangerous to your mental health. User-Agent: Mutt/1.5.11+cvs20060126 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1356 Lines: 36 On Tue 2007-01-09 13:01:10, Andrew Morton wrote: > On Mon, 8 Jan 2007 22:14:46 -0500 > Mathieu Desnoyers wrote: > > > +* How to use local atomic operations > > + > > +#include > > +#include > > + > > +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 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/