From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Piggin Subject: Re: [patch 2/4] lglock: introduce special lglock and brlock spin locks Date: Sat, 5 Jun 2010 00:13:18 +1000 Message-ID: <20100604141318.GC26335@laptop> References: <20100604064307.737085373@suse.de> <20100604072618.400686656@suse.de> <1275638163.2482.2.camel@edumazet-laptop> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Al Viro , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, "Paul E. McKenney" , Frank Mayhar , John Stultz , Andi Kleen To: Eric Dumazet Return-path: Content-Disposition: inline In-Reply-To: <1275638163.2482.2.camel@edumazet-laptop> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Fri, Jun 04, 2010 at 09:56:03AM +0200, Eric Dumazet wrote: > Le vendredi 04 juin 2010 =E0 16:43 +1000, Nick Piggin a =E9crit : > > pi=E8ce jointe document texte brut (kernel-introduce-brlock.patch) > > This patch introduces "local-global" locks (lglocks). These can be = used to: > >=20 > > - Provide fast exclusive access to per-CPU data, with exclusive acc= ess to > > another CPU's data allowed but possibly subject to contention, an= d to provide > > very slow exclusive access to all per-CPU data. > > - Or to provide very fast and scalable read serialisation, and to p= rovide > > very slow exclusive serialisation of data (not necessarily per-CP= U data). > >=20 > > Brlocks are also implemented as a short-hand notation for the latte= r use > > case. > >=20 > > Thanks to Paul for local/global naming convention. > >=20 > > Cc: linux-kernel@vger.kernel.org > > Cc: linux-fsdevel@vger.kernel.org > > Cc: Al Viro > > Cc: "Paul E. McKenney" > > Cc: Frank Mayhar , > > Cc: John Stultz > > Cc: Andi Kleen > > Signed-off-by: Nick Piggin > > --- > > include/linux/lglock.h | 165 ++++++++++++++++++++++++++++++++++++= +++++++++++++ > > 1 file changed, 165 insertions(+) > >=20 >=20 > IMHO some changes in Documentation/ would be needed I wonder where, and what? =20 > > + void name##_global_lock(void) { \ > > + int i; \ > > + preempt_disable(); \ > > + rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \ > > + for_each_online_cpu(i) { \ >=20 > for_each_possible_cpu() Oh good spotting. brlock does not need this but lglock does if it protects offline cpu data too. Maybe better to move file handles in the event of hotplug.