Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7808230rwb; Wed, 23 Nov 2022 11:01:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Jnsjtgz2SehhGeqHBVVU3b2lstS1xewgf4xf2buCtZ5BG6Lx508dRMDlLUhTf4SDDo5E/ X-Received: by 2002:a17:902:8c8e:b0:188:d588:34f2 with SMTP id t14-20020a1709028c8e00b00188d58834f2mr23345497plo.15.1669230094850; Wed, 23 Nov 2022 11:01:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669230094; cv=none; d=google.com; s=arc-20160816; b=gGsU2Zt18JaZAFskZYk6QgkO9G1ZiV4ZzthDxvYttaE1EWYKq/CwziU8Aw6wg2kX+m njpd/cPK0ul45zieG0EPWkz471nYe72dp5x5eQae7NreQgXJG/WSX+VwITVHBq5gN1HZ EhEW/1eNsmN/PPvm+EVXxXjzosS5o2QdH91OPRY4LhM8LvyTI+WeJMlRnhQ77AW229gB UXc8/euvqH/Hbq5FJDKWZ4QQxde5bVzpBdi2xCokGdCm1YJrC+F9fTpmJMYj0SF0NX55 iszh7UDt/FUxh+tclIYj2kV5rtW260/7APq75Y7ukypWj8flFDJtwOhwIj5vxnWugYwO aW1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=KnGYVbKcX34JDd+99Xqe3lFPF2j8pM3iXP21Xnre3Qk=; b=CQcJlAKmbo0/aczyM0RLmFJ1qCqoJGAPGsmXzN3t1Rgh5cwFINH3mC9HYQ32yVpTiE yxLCH3oQbFND/ks4uklo6CFX2bZ17BOYXuZjFXWIh5ezl0G6VOUJ7jSYUN12lcS5Tb7m olYUSrHWg6Xn+iY6ypIliLDEUcCsHxP5yVflhflgfA0/Y3X3w24FCO8uImyfu6UR8Xx2 oKOiMLTSe59qE6lWDzdjpFe5jbgP2M03CVVRr/R1EAbXLrFkyxS2EqrRsSu2eu7Qg6ZQ FWZF6lMLibqsZrG07NV+C46+iUl5S1NB4Q2cBZpVWTNadhgpqd8cm5Y04sm95bpVM8CE 4tZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZmFzWMqQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t17-20020a170902e85100b001870dc9ef63si19603507plg.129.2022.11.23.11.01.23; Wed, 23 Nov 2022 11:01:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZmFzWMqQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237243AbiKWRyn (ORCPT + 88 others); Wed, 23 Nov 2022 12:54:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236601AbiKWRyl (ORCPT ); Wed, 23 Nov 2022 12:54:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6152E65844; Wed, 23 Nov 2022 09:54:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E55BBB82208; Wed, 23 Nov 2022 17:54:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97AA9C433D7; Wed, 23 Nov 2022 17:54:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669226077; bh=KojPnCJDd+viWW6lLyZAJlQQAA7kDDhcYbMJeadUl/g=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=ZmFzWMqQyUimMTw5jdhvuXaNi9STJVNZY0Dj3dlMyquHVUUkGbbMCY4ot4DNMsNqT PFmUbxfCqQIOf+slnTfIercvXQvZhn2v82VM+yFA25mLs63I9cB4itvtbZL4Ho+4EB RRBISd6ETV0iFXGXQGqmYcO67QR+QRjj+5+eIcXmbAZ0gNV/aZ0KDK1TXfdLEw67v6 eLTwtI9A6uwVrI73FKLibYsqMEdYH9Rv0OoTZcEPfkvOGsMI7oUrMLOtsx4/ma6ky6 gkck0ema33P83/BIt6BOqVGNcE2yMFaQOyEyt31ZrpxxJSaMOok7GX8cj9ous7Tj27 EYG6j/JywzdeA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 3313F5C0A3F; Wed, 23 Nov 2022 09:54:37 -0800 (PST) Date: Wed, 23 Nov 2022 09:54:37 -0800 From: "Paul E. McKenney" To: Frederic Weisbecker Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Joel Fernandes (Google)" Subject: Re: [PATCH v2 rcu 05/16] rcu: Refactor code a bit in rcu_nocb_do_flush_bypass() Message-ID: <20221123175437.GA4001@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20221122010408.GA3799268@paulmck-ThinkPad-P17-Gen-1> <20221122010421.3799681-5-paulmck@kernel.org> <20221123155929.GB1387380@lothringen> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221123155929.GB1387380@lothringen> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 23, 2022 at 04:59:29PM +0100, Frederic Weisbecker wrote: > On Mon, Nov 21, 2022 at 05:04:10PM -0800, Paul E. McKenney wrote: > > From: "Joel Fernandes (Google)" > > > > This consolidates the code a bit and makes it cleaner. Functionally it > > is the same. > > > > Reported-by: Paul E. McKenney > > Signed-off-by: Joel Fernandes (Google) > > Signed-off-by: Paul E. McKenney > > --- > > kernel/rcu/tree_nocb.h | 17 +++++++++-------- > > 1 file changed, 9 insertions(+), 8 deletions(-) > > > > diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h > > index d6e4c076b0515..213daf81c057f 100644 > > --- a/kernel/rcu/tree_nocb.h > > +++ b/kernel/rcu/tree_nocb.h > > @@ -327,10 +327,11 @@ static void wake_nocb_gp_defer(struct rcu_data *rdp, int waketype, > > * > > * Note that this function always returns true if rhp is NULL. > > */ > > -static bool rcu_nocb_do_flush_bypass(struct rcu_data *rdp, struct rcu_head *rhp, > > +static bool rcu_nocb_do_flush_bypass(struct rcu_data *rdp, struct rcu_head *rhp_in, > > unsigned long j, bool lazy) > > { > > struct rcu_cblist rcl; > > + struct rcu_head *rhp = rhp_in; > > Why that intermediate rhp_in? To avoid modifying the formal parameter, should the original value prove useful, for example, for tracing or debugging. > > WARN_ON_ONCE(!rcu_rdp_is_offloaded(rdp)); > > rcu_lockdep_assert_cblist_protected(rdp); > > @@ -345,16 +346,16 @@ static bool rcu_nocb_do_flush_bypass(struct rcu_data *rdp, struct rcu_head *rhp, > > > > /* > > * If the new CB requested was a lazy one, queue it onto the main > > - * ->cblist so we can take advantage of a sooner grade period. > > + * ->cblist so that we can take advantage of the grace-period that will > > + * happen regardless. But queue it onto the bypass list first so that > > + * the lazy CB is ordered with the existing CBs in the bypass list. > > */ > > if (lazy && rhp) { > > - rcu_cblist_flush_enqueue(&rcl, &rdp->nocb_bypass, NULL); > > - rcu_cblist_enqueue(&rcl, rhp); > > - WRITE_ONCE(rdp->lazy_len, 0); > > - } else { > > - rcu_cblist_flush_enqueue(&rcl, &rdp->nocb_bypass, rhp); > > - WRITE_ONCE(rdp->lazy_len, 0); > > + rcu_cblist_enqueue(&rdp->nocb_bypass, rhp); > > + rhp = NULL; > > } > > + rcu_cblist_flush_enqueue(&rcl, &rdp->nocb_bypass, rhp); > > + WRITE_ONCE(rdp->lazy_len, 0); > > Reviewed-by: Frederic Weisbecker Thank you! I will apply this on my next rebase. Thanx, Paul > Thanks. > > > > > rcu_segcblist_insert_pend_cbs(&rdp->cblist, &rcl); > > WRITE_ONCE(rdp->nocb_bypass_first, j); > > -- > > 2.31.1.189.g2e36527f23 > >