From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941006AbcHJTMd (ORCPT ); Wed, 10 Aug 2016 15:12:33 -0400 Received: from merlin.infradead.org ([205.233.59.134]:34230 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934242AbcHJTM0 (ORCPT ); Wed, 10 Aug 2016 15:12:26 -0400 Date: Wed, 10 Aug 2016 09:56:06 +0200 From: Peter Zijlstra To: John Stultz Cc: Oleg Nesterov , "Paul E. McKenney" , Ingo Molnar , lkml , Tejun Heo , Dmitry Shmidt , Rom Lemarchand , Colin Cross , Todd Kjos Subject: Re: [PATCH v2] locking/percpu-rwsem: Optimize readers and reduce global impact Message-ID: <20160810075606.GK6879@twins.programming.kicks-ass.net> References: <20160809095112.GG30192@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 09, 2016 at 04:47:38PM -0700, John Stultz wrote: > On Tue, Aug 9, 2016 at 2:51 AM, Peter Zijlstra wrote: > > > > Currently the percpu-rwsem switches to (global) atomic ops while a > > writer is waiting; which could be quite a while and slows down > > releasing the readers. > > > > This patch cures this problem by ordering the reader-state vs > > reader-count (see the comments in __percpu_down_read() and > > percpu_down_write()). This changes a global atomic op into a full > > memory barrier, which doesn't have the global cacheline contention. > > > > This also enables using the percpu-rwsem with rcu_sync disabled in order > > to bias the implementation differently, reducing the writer latency by > > adding some cost to readers. > > So this by itself doesn't help us much, but including the following > from Oleg does help quite a bit: Correct, Oleg was going to send his rcu_sync rework on top of this. But since its holiday season things might be tad delayed.