Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1671138pxb; Fri, 6 Nov 2020 16:27:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXA1P6oWA/Pc2bMUIZK8RNC6nNI96jcJGKsTOK2IlFYiCyRrAUd1SxSSyQ3h21OMZz0g+g X-Received: by 2002:a05:6402:206:: with SMTP id t6mr4682181edv.291.1604708875483; Fri, 06 Nov 2020 16:27:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604708875; cv=none; d=google.com; s=arc-20160816; b=YCFjM8AvmFlDHjogAChpIjdsIftMqhERl6My0D0YRuFLy68pREKxVNfoFHKD06FqSf MckxVdgSW10MJRejzZFDKGpVgpF13Ia+k7VlybHSaDYiu1i8vyOlUBgttnn+Km6o3Dt0 bS7QBdgKwN9YzZQdC5MZbq6BDif83PXGbpB+gqTT96cV2ty1ZC0PxoMa0CL1MjDN2kIZ 4rXs6T4hS0Q7q+otheX+dmaLcDzNWdwBV7JbCZjyyU5SrBLgFpAfJwgwYNyUIAhe6aBT GZIj67Jen8gy4dQ6L86k62fRHbBJCF5FRVSq/6bFPrioQ0J0p57z//L7jzylO4IKoy92 yMpg== 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=KFCIKOtr8D20sOqDg+VtqMdBmuE8IZF7YxjxZvbO66w=; b=nzLj7Vt8N/XbsBUjIA6tP9+ApJXg70IOKu4TuQSdfj+4w9/vYPC11xSibbYcGhwiKj rCeUA1pLRQytznBdD8742LI1nqoPVvEgUG8h/Q8d0yNGybZ+AjAUQcR3XqSi2aF04LEM wQ8I/vHDhcO12+neuneKjEit8lSTI7zp12qyRrPkF42Anp7kvD+bI/lKz7ByNmczCNSQ BVfSjJyM2Oki+6aVkbnpuR8ZRrBK8NUPmN+Dqf7TRzYIu8jlTcXF7c9iYt3uAGkulFAU GfjHh+LiQRhFuJF0KQJz9ZvUsmDCfpaDcuxjvlOX6oysVL73l0f1wHAZtF0HbMVU6fru 9EgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=wXIYaB5J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r7si2029756ejb.27.2020.11.06.16.27.25; Fri, 06 Nov 2020 16:27:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=wXIYaB5J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727178AbgKGA0G (ORCPT + 99 others); Fri, 6 Nov 2020 19:26:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726447AbgKGA0G (ORCPT ); Fri, 6 Nov 2020 19:26:06 -0500 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78236C0613CF for ; Fri, 6 Nov 2020 16:26:06 -0800 (PST) Received: by mail-qk1-x742.google.com with SMTP id l2so2841482qkf.0 for ; Fri, 06 Nov 2020 16:26:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=KFCIKOtr8D20sOqDg+VtqMdBmuE8IZF7YxjxZvbO66w=; b=wXIYaB5JyJigBToTrk98QDXEreKm1YQNF4z1vvaZ9Pn7oLWmVqoiIIv2NXNNEK/vQ8 oRkZJF7/bBYDbqGiS6+8qr9gEYnYaJzQyOc1biqlp21w504HrMaVbsQwuu/NIT6t+nb9 FNgBvkSQr3O09VEMu9WvKxdEwwxPqowuxsrkw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KFCIKOtr8D20sOqDg+VtqMdBmuE8IZF7YxjxZvbO66w=; b=jdO/cpsW4K20oRM4YuYf813CQ3kk5IcUVGjA3PBIBA0k0kgSLrbEcG1b8cPMpGz6ef PpElJJc5ug9GIzg4X75kZ+xcxPcJGcvCIL05677COvyhrzERzYxp8UEU722G4kvyazyC Bwp/Uh00qqqcWb+fktQaSXVaBQ5kkwKHitY+C536Sonrr8zJq2hbQlaBJM/HAkBFll4x 9goPTjOMShrAelNKQvrBmDQUt2A/v/kJLenFibdAiRAqhLgrXUbLwmxobRh2dhOfEtqj eXED/i0evAGaKLqrXXJ8UnbKY2txS3BCYHKFHeGL+WGYMsT8sHjNjpFSFjrobA6KVe4I MOnA== X-Gm-Message-State: AOAM530CX6psDkKhUk96EET8XET8yfya/WZDzBvwzaUQM9KYKJXEAcvr 15eDA6xMFYjD2Btm8o7FID8/FmP1w4xCrA== X-Received: by 2002:a05:620a:951:: with SMTP id w17mr4470185qkw.224.1604708765505; Fri, 06 Nov 2020 16:26:05 -0800 (PST) Received: from localhost ([2620:15c:6:411:cad3:ffff:feb3:bd59]) by smtp.gmail.com with ESMTPSA id x7sm1534652qtw.76.2020.11.06.16.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Nov 2020 16:26:04 -0800 (PST) Date: Fri, 6 Nov 2020 19:26:04 -0500 From: Joel Fernandes To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, Frederic Weisbecker , Josh Triplett , Lai Jiangshan , Marco Elver , Mathieu Desnoyers , rcu@vger.kernel.org, Steven Rostedt , "Uladzislau Rezki (Sony)" , fweisbec@gmail.com, neeraj.iitr10@gmail.com Subject: Re: [PATCH v9 6/7] rcu/tree: segcblist: Remove redundant smp_mb()s Message-ID: <20201107002604.GA3144506@google.com> References: <20201103142603.1302207-1-joel@joelfernandes.org> <20201103142603.1302207-7-joel@joelfernandes.org> <20201105035713.GL3249@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201105035713.GL3249@paulmck-ThinkPad-P72> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 04, 2020 at 07:57:13PM -0800, Paul E. McKenney wrote: > On Tue, Nov 03, 2020 at 09:26:02AM -0500, Joel Fernandes (Google) wrote: > > This memory barrier is not needed as rcu_segcblist_add_len() already > > includes a memory barrier *before* and *after* the length of the list is > > updated. > > > > Same reasoning for rcu_segcblist_enqueue(). > > I suggest a commit log like the following: > > ------------------------------------------------------------------------ > > The full memory barriers in rcu_segcblist_enqueue() and in rcu_do_batch() > are not needed because rcu_segcblist_add_len(), and thus also > rcu_segcblist_inc_len(), already includes a memory barrier *before* > and *after* the length of the list is updated. > > This commit therefore removes these redundant smp_mb() invocations. > > ------------------------------------------------------------------------ > > Other than that, looks good! I could hand-apply it, but that > would just cause more churn with the addition of the call to > rcu_segcblist_inc_seglen(). So could you please update the commit log > when you repost, whether to the mailing list or from your git tree? Done, I updated it in my tree. I will share the link to tree on IRC. thanks, - Joel > > Thanx, Paul > > > Reviewed-by: Frederic Weisbecker > > Signed-off-by: Joel Fernandes (Google) > > --- > > kernel/rcu/rcu_segcblist.c | 1 - > > kernel/rcu/tree.c | 1 - > > 2 files changed, 2 deletions(-) > > > > diff --git a/kernel/rcu/rcu_segcblist.c b/kernel/rcu/rcu_segcblist.c > > index e9e72d72f7a6..d96272e8d604 100644 > > --- a/kernel/rcu/rcu_segcblist.c > > +++ b/kernel/rcu/rcu_segcblist.c > > @@ -268,7 +268,6 @@ void rcu_segcblist_enqueue(struct rcu_segcblist *rsclp, > > struct rcu_head *rhp) > > { > > rcu_segcblist_inc_len(rsclp); > > - smp_mb(); /* Ensure counts are updated before callback is enqueued. */ > > rcu_segcblist_inc_seglen(rsclp, RCU_NEXT_TAIL); > > rhp->next = NULL; > > WRITE_ONCE(*rsclp->tails[RCU_NEXT_TAIL], rhp); > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > > index f6c6653b3ec2..fb2a5ac4a59c 100644 > > --- a/kernel/rcu/tree.c > > +++ b/kernel/rcu/tree.c > > @@ -2525,7 +2525,6 @@ static void rcu_do_batch(struct rcu_data *rdp) > > > > /* Update counts and requeue any remaining callbacks. */ > > rcu_segcblist_insert_done_cbs(&rdp->cblist, &rcl); > > - smp_mb(); /* List handling before counting for rcu_barrier(). */ > > rcu_segcblist_add_len(&rdp->cblist, -count); > > > > /* Reinstate batch limit if we have worked down the excess. */ > > -- > > 2.29.1.341.ge80a0c044ae-goog > >