Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7607028rwb; Wed, 23 Nov 2022 08:30:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf5b/E42vIPyKcLCFyOuUSaNAdxhaTDgiK6vAj1UsUZHwTYSopGP9uz8ALxMaV/Aij4lDg9w X-Received: by 2002:aa7:c30c:0:b0:469:80b7:a16a with SMTP id l12-20020aa7c30c000000b0046980b7a16amr13279157edq.306.1669221001817; Wed, 23 Nov 2022 08:30:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669221001; cv=none; d=google.com; s=arc-20160816; b=H0hLE4SiD4kbUTt59b5cLXCjC2cZzEwiuRvZgy9nTe8WQd6C7sPWS4rEfe40Ss1Sze 9rlfLhp7nzNcj1H8adSbPEbbrf/spm/PibsOuAgcH4Tua+T8ZnYyQ3EE2OkRju9DBayn BHwoRNZG9QjjYVMcMdjNKGro5WFdt1pD4NZigksRVIBqletffeXL7ICVsELIzpSxDTjG +pj93fbYd5Vr4WUw/kpOCVL0pfHf3WEcLO+a186RPt0sEtjWK0P4JnUiwABajbD9YAx/ ZHu/TmOdJ8Mav2eu3XG9dWdKBhC8+SbLYhU8bONkmcp4aqBkDwayfDFfUf5A0UvqodmD dZXA== 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:message-id:subject:cc:to:from:date:dkim-signature; bh=N1KppXuCk20DFaqiT1nbmwqLg45JJMsSDNLaWgf2kwY=; b=UPG+pmmPZLhqnG8/5keMusgXy5No5pm++dZwKk5dY6UNI7htr8RQJpdBEzd85Y1YXk WKOT6ysXfs05w4/I0dUPXMexj1/J8xAy25Qle0QqA/8rR1NTeJIv8zAhsvEEsj1UebVQ ZAyDOpAJWTzF9FKRm3kKHAI4l6jJ+8vgREeADIbesw7NC5AIk0Hc/jkFloMapUEv3XYC fz8r9n0FpnmXjGsQv5AGnV0cr4ulW91lDI1z39Wx6wbTFjoIz2cCb1gFQHsM4rFOsKjc Js1MtJRKK89T3PkdZ/SOoQPft8c+pcnQMIXepkO+0FawvrVYSIaDIokWiiUnHNKN272f fcMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y8XtedCI; 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 h30-20020a0564020e9e00b0046993a5bf13si7336683eda.554.2022.11.23.08.29.37; Wed, 23 Nov 2022 08:30:01 -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=Y8XtedCI; 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 S238181AbiKWP7n (ORCPT + 88 others); Wed, 23 Nov 2022 10:59:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235918AbiKWP7d (ORCPT ); Wed, 23 Nov 2022 10:59:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CE8EDD; Wed, 23 Nov 2022 07:59:33 -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 dfw.source.kernel.org (Postfix) with ESMTPS id BB56361DDD; Wed, 23 Nov 2022 15:59:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A36D7C433C1; Wed, 23 Nov 2022 15:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669219172; bh=xhSayXw1inqZZFR8s8TjR7HOd4tlJGjeZ7YEdMkj0Dw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Y8XtedCI2cb2NetRpBy1LlZ+TWi4QP9EUWRkC2deGnsJYW9UVOjt80Is59hSqFyLY HH4bCYAqZt9gIh/1DGIasGWhgO5STPf/oEMiyJUZuSdRwDZitVJTLuOgYLYOvMI+2d gHejASlEU2w3FyAQI9lixHIJpbPDXs11ZRwgnbM4bjLErBTQtNxVMjIhUsoO0yipOb RxpdNqc3cOObreVzSFdGQtgQU6BpqzFPkb2UcmsUCCrVDZoFTCn7FIZbv3k++PpimE UTujas1rpDHzA0EhR1CaxDCrKZ+wLgd21dCuWtNNFXSTNOwHFBZBE6EIaNQZ22Sj0+ sSljr25NhDKQA== Date: Wed, 23 Nov 2022 16:59:29 +0100 From: Frederic Weisbecker To: "Paul E. McKenney" 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: <20221123155929.GB1387380@lothringen> References: <20221122010408.GA3799268@paulmck-ThinkPad-P17-Gen-1> <20221122010421.3799681-5-paulmck@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221122010421.3799681-5-paulmck@kernel.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 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? > > 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 Thanks. > > rcu_segcblist_insert_pend_cbs(&rdp->cblist, &rcl); > WRITE_ONCE(rdp->nocb_bypass_first, j); > -- > 2.31.1.189.g2e36527f23 >