From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932964AbbFWOjt (ORCPT ); Tue, 23 Jun 2015 10:39:49 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:59597 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754805AbbFWOjl (ORCPT ); Tue, 23 Jun 2015 10:39:41 -0400 X-Helo: d03dlp03.boulder.ibm.com X-MailFrom: paulmck@linux.vnet.ibm.com X-RcptTo: linux-kernel@vger.kernel.org Date: Tue, 23 Jun 2015 07:39:35 -0700 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Oleg Nesterov , tj@kernel.org, mingo@redhat.com, linux-kernel@vger.kernel.org, der.herr@hofr.at, dave@stgolabs.net, riel@redhat.com, viro@ZenIV.linux.org.uk, torvalds@linux-foundation.org Subject: Re: [RFC][PATCH 12/13] stop_machine: Remove lglock Message-ID: <20150623143935.GI3892@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <20150622121623.291363374@infradead.org> <20150622122256.765619039@infradead.org> <20150622222152.GA4460@redhat.com> <20150623100932.GB3644@twins.programming.kicks-ass.net> <20150623105548.GE18673@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150623105548.GE18673@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15062314-0009-0000-0000-00000BEAB96E Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 23, 2015 at 12:55:48PM +0200, Peter Zijlstra wrote: > On Tue, Jun 23, 2015 at 12:09:32PM +0200, Peter Zijlstra wrote: > > We can of course slap a percpu-rwsem in, but I wonder if there's > > anything smarter we can do here. > > Urgh, we cannot use percpu-rwsem here, because that would require > percpu_down_write_trylock(), and I'm not sure we can get around the > sync_sched() for that. > > Now try_stop_cpus(), which requires the down_write_trylock() is used to > implement synchronize_sched_expedited(). > > Using sync_sched() to implement sync_sched_expedited would make me > happy, but it does somewhat defeat the purpose. > > > > Also, I think _expedited is used too eagerly, look at this: > > +void dm_sync_table(struct mapped_device *md) > +{ > + synchronize_srcu(&md->io_barrier); > + synchronize_rcu_expedited(); > +} > > sync_srcu() is slow already, why then bother with an > sync_rcu_expedited() :/ Actually, this code was added in 2013, which was after the new variant of synchronize_srcu(), which last I checked is reasonably fast in the common case (no readers and not having tons of concurrent synchronize_srcu() calls on the same srcu_struct), especially on systems with a small number of CPUs, courtesy of srcu_read_lock()'s and srcu_read_unlock()'s read-side memory barriers. So synchronize_rcu() really would be expected to have quite a bit higher latency than synchronize_srcu(). Thanx, Paul