Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757968AbZGCPkV (ORCPT ); Fri, 3 Jul 2009 11:40:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756962AbZGCPkH (ORCPT ); Fri, 3 Jul 2009 11:40:07 -0400 Received: from tomts5-srv.bellnexxia.net ([209.226.175.25]:64720 "EHLO tomts5-srv.bellnexxia.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756519AbZGCPkG (ORCPT ); Fri, 3 Jul 2009 11:40:06 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgoFAI+9TUpMQWU3/2dsb2JhbACBUMxfhBIFgTo Date: Fri, 3 Jul 2009 11:40:07 -0400 From: Mathieu Desnoyers To: Herbert Xu Cc: mingo@elte.hu, jolsa@redhat.com, a.p.zijlstra@chello.nl, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, fbl@redhat.com, nhorman@redhat.com, davem@redhat.com, htejun@gmail.com, jarkao2@gmail.com, oleg@redhat.com, davidel@xmailserver.org, eric.dumazet@gmail.com, Paul.McKenney@us.ibm.com Subject: Re: [PATCHv5 2/2] memory barrier: adding smp_mb__after_lock Message-ID: <20090703154007.GC10256@Krystal> References: <20090703140401.GA10256@Krystal> <20090703152951.GA28837@gondor.apana.org.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: <20090703152951.GA28837@gondor.apana.org.au> X-Editor: vi X-Info: http://krystal.dyndns.org:8080 X-Operating-System: Linux/2.6.21.3-grsec (i686) X-Uptime: 11:33:24 up 125 days, 11:59, 4 users, load average: 0.17, 0.44, 0.53 User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1923 Lines: 52 * Herbert Xu (herbert@gondor.apana.org.au) wrote: > Mathieu Desnoyers wrote: > > > > Why don't we create a read_lock without acquire semantic instead (e.g. > > read_lock_nomb(), or something with a better name like __read_lock()) ? > > On architectures where memory barriers are needed to provide the acquire > > semantic, it would be faster to do : > > > > __read_lock(); > > smp_mb(); > > > > than : > > > > read_lock(); <- e.g. lwsync + isync or something like that > > smp_mb(); <- full sync. > > Hmm, why do we even care when read_lock should just die? > I guess you are proposing migration from rwlock to RCU ? Well, in cases where critical sections are in the order of 20000 cycles or more, and with 8 to 64-core machines, there is no significant gain in using RCU vs rwlocks, so the added complexity might not be justified if the critical sections are very long. But then it's a case by case thing. We would have to see what exactly is protected by this read lock and how long the critical section is. However, in any case, you are right: rwlocks are acceptable only for long critical sections, for which we just don't care about one extra memory barrier. Instead of optimizing away these read-side rwlock barriers, we would spend our time much more efficiently switching to RCU read side. Mathieu > Cheers, > -- > Visit Openswan at http://www.openswan.org/ > Email: Herbert Xu ~{PmV>HI~} > Home Page: http://gondor.apana.org.au/~herbert/ > PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- Mathieu Desnoyers OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68 -- 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/