From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752414AbcEUROs (ORCPT ); Sat, 21 May 2016 13:14:48 -0400 Received: from mx2.suse.de ([195.135.220.15]:56237 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752105AbcEUROq (ORCPT ); Sat, 21 May 2016 13:14:46 -0400 Date: Sat, 21 May 2016 10:14:35 -0700 From: Davidlohr Bueso To: Peter Zijlstra Cc: Linus Torvalds , Boqun Feng , Manfred Spraul , Waiman Long , Ingo Molnar , ggherdovich@suse.com, Mel Gorman , Linux Kernel Mailing List , Paul McKenney , Will Deacon Subject: Re: sem_lock() vs qspinlocks Message-ID: <20160521171435.GB6899@linux-uzut.site> References: <20160520053926.GC31084@linux-uzut.site> <20160520115819.GF3193@twins.programming.kicks-ass.net> <20160520140533.GA20726@insomnia> <20160520152149.GH3193@twins.programming.kicks-ass.net> <20160520160436.GQ3205@twins.programming.kicks-ass.net> <20160520210618.GK3193@twins.programming.kicks-ass.net> <20160521004839.GA28231@linux-uzut.site> <20160521073739.GB15728@worktop.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20160521073739.GB15728@worktop.ger.corp.intel.com> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 21 May 2016, Peter Zijlstra wrote: >On Fri, May 20, 2016 at 05:48:39PM -0700, Davidlohr Bueso wrote: >> On Fri, 20 May 2016, Linus Torvalds wrote: >> >> >> >Oh, I definitely agree on the stable part, and yes, the "splt things >> >up" model should come later if people agree that it's a good thing. >> >> The backporting part is quite nice, yes, but ultimately I think I prefer >> Linus' suggestion making things explicit, as opposed to consulting the spinlock >> implying barriers. I also hate to have an smp_mb() (particularly for spin_is_locked) >> given that we are not optimizing for the common case (regular mutual excl). > >I'm confused; we _are_ optimizing for the common case. spin_is_locked() >is very unlikely to be used. And arguably should be used less in favour >of lockdep_assert_held(). Indeed we are. But by 'common case' I was really thinking about spin_is_locked() vs spin_wait_unlock(). The former being the more common of the two, and the one which mostly will _not_ be used for lock correctness purposes, hence it doesn't need that new smp_mb. Hence allowing users to explicitly set the ordering needs (ie spin_lock_synchronize()) seems like the better long term alternative. otoh, with your approach all such bugs are automatically fixed :) Thanks, Davidlohr