Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp988092ybn; Wed, 2 Oct 2019 09:10:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgO/UIxxtzBu/ViETuKb5HTVbNObD8zNScc5Jf5FU65Xw32e5eqJ1bky1kF9aRTpOwkFlG X-Received: by 2002:a50:d5c5:: with SMTP id g5mr4707562edj.57.1570032653909; Wed, 02 Oct 2019 09:10:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570032653; cv=none; d=google.com; s=arc-20160816; b=wQS/CL/K8qx0zqaLnuvQ87O0x9uuUsEVMaiaiepkO/kbeZlIdQPFFUzgn3M4ubYCQQ 4bmtUQoMi67FcVrwurahKriwxsVtoHjXwPQZbl7U8TqTUd0i2GKEPyBCtufib57KhBNR w5PNVu3VCFi9BM1glBHI5pkSBy9FboFnGG7YqTW3D3BTwPhJkFBJ/pOCFlwvKju1pBlP 79zgndlPKJmvkZVW3DaU5dFyi22Asn0YEe4dv0e1AAaAyUP2j7QqF06gt50Ypz9qE4vd UVABodUAlELfpi5GwCa9mSuBrHpbpNBvPy+YGGuTkDs8dPfcc0r4vr+oAS1VLhgVqXAU Yf8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=CLSRaQnr8C0xRNF5O8rwY0VKP24vcCn1ykTxGwomFjo=; b=fkp8ij2/+bxQ9V6DFNjbwOPAN27xExuOSb9jw3uoyqSHqVC/G1EJCwiP93XeDYLi29 IonVUiMaysNe0lBFFz8cie/fERvE8uYIegQuYgKjHNLWQzqDv9ids5CAL8+UrBKVEaN6 HEJV9rQrtSSUNGvtlZuc/u/+RaPEID6Wjg1LtjyNZ3sSjAFbO8jaSAfw8/rZOuU6bXPS phWlf8HAigsFAL+QzAhOuygtgRDrbtD7qDGDaYcUgFR1smUj+AknygkaNvN9GjWsZRKd HKtflluP86lXAVAVYkEnL3CXSviYJhp9kn58OeSn6/C7N7bWsH8UHHBV6liWDGECrJNK CMYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14si13504769eda.8.2019.10.02.09.10.23; Wed, 02 Oct 2019 09:10:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728129AbfJBPRV convert rfc822-to-8bit (ORCPT + 99 others); Wed, 2 Oct 2019 11:17:21 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:60240 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726330AbfJBPRV (ORCPT ); Wed, 2 Oct 2019 11:17:21 -0400 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1iFgNT-0005TD-62; Wed, 02 Oct 2019 17:17:19 +0200 Date: Wed, 2 Oct 2019 17:17:19 +0200 From: Sebastian Andrzej Siewior To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, Dennis Zhou , Tejun Heo , Christoph Lameter , Thomas Gleixner , Peter Zijlstra Subject: Re: [PATCH] percpu-refcount: Use normal instead of RCU-sched" Message-ID: <20191002151718.eicbn4ahdanwuggh@linutronix.de> References: <20191002112252.ro7wpdylqlrsbamc@linutronix.de> <20191002150852.GB2689@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <20191002150852.GB2689@paulmck-ThinkPad-P72> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-10-02 08:08:52 [-0700], Paul E. McKenney wrote: > On Wed, Oct 02, 2019 at 01:22:53PM +0200, Sebastian Andrzej Siewior wrote: > > This is a revert of commit > > a4244454df129 ("percpu-refcount: use RCU-sched insted of normal RCU") > > > > which claims the only reason for using RCU-sched is > > "rcu_read_[un]lock() … are slightly more expensive than preempt_disable/enable()" > > > > and > > "As the RCU critical sections are extremely short, using sched-RCU > > shouldn't have any latency implications." > > > > The problem with using RCU-sched here is that it disables preemption and > > the callback must not acquire any sleeping locks like spinlock_t on > > PREEMPT_RT which is the case with some of the users. > > Looks good in general, but changing to RCU-preempt does not change the > fact that the callbacks execute with bh disabled. There is a newish > queue_rcu_work() that invokes a workqueue handler after a grace period. > > Or am I missing your point here? That is fine, no the RCU callback. The problem is that percpu_ref_put_many() as of now does: rcu_read_lock_sched(): /* aka preempt_disable(); */ if (__ref_is_percpu(ref, &percpu_count)) this_cpu_sub(*percpu_count, nr); else if (unlikely(atomic_long_sub_and_test(nr, &ref->count))) ref->release(ref); and then the callback invoked via ref->release() acquires a spinlock_t with disabled preemption. > Thanx, Paul Sebastian