Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3654122pxb; Mon, 9 Nov 2020 17:46:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzI9nPqod1pGUjQxNAutx0Bly/96SzkNixMm9ny/OEfmEQtKuAGR2BA2qPokPCmHRFPkzJ8 X-Received: by 2002:aa7:c151:: with SMTP id r17mr14519817edp.216.1604972768654; Mon, 09 Nov 2020 17:46:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604972768; cv=none; d=google.com; s=arc-20160816; b=N+vhBpGcEwtK2+O585Fd1gy8WGrJtHkk0xDfXkcV6Gj9VyP79SkXhF/9vlJNTM7Uco GTBKGavH8Ill96QnMf+jwJGwe7TwzRBvp+UOu9vgQKndODEYPYUrgnJlI8QqJXBgpfvb 9ulk9fnFlDTh2ET/1NaYGcPAzN224R0fzH9oJI3TJGfboZbH/9+kBfiI3hTgwZQy5ne0 RBBgfauDqEsNawYhTwyUfTIHgajgyX9Y4WD3KksvytAS6qem7wobxH+az5KjxEtcq/+6 7IhkM1YTPxM0YmwacnvDQi5SGe2gOdw5K/wZzPSrJ6XlVyvl3oBm3hdrefmwRbfxN4RN B03A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=3uHPfmZdcuqxxjyycoVdiSnPtf3YG1zDRJccVcjfiag=; b=cQJ0mRAm6I8rPxduT7Tg8W5tA1hCFg5ANY6btiWxL93EIq01rTPWHO0JOm/u6Hkas2 Ik1rQJZxuATTm88Fxnryrctm1dAv0Oc6QTnOkQh3p/6lpIksvRuSH522bsaQS90QQmHD FrX9a2nS1tQLv01KEOzjxy3n1OSLJD3jPIANlzfp8O61unNrFNsRl6J1ql0yMjp9xCtR j37TIikpEjgBAFGERnM2EJIYxNJcDY+GU5JzRiGbl0Mq2xQsjEqsXSOBVkcohFN1L9EA VJXQLztuTImCACNFS+NcDRbyWP/UAi4GwoGk4yhs98wfP33xq+Ggucxcmks7cnOyqzdx tPLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=El7+2IqG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id df12si5888794edb.5.2020.11.09.17.45.46; Mon, 09 Nov 2020 17:46:08 -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=@kernel.org header.s=default header.b=El7+2IqG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731332AbgKJBl5 (ORCPT + 99 others); Mon, 9 Nov 2020 20:41:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:34274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731402AbgKJBlw (ORCPT ); Mon, 9 Nov 2020 20:41:52 -0500 Received: from paulmck-ThinkPad-P72.home (50-39-104-11.bvtn.or.frontiernet.net [50.39.104.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0C379207D3; Tue, 10 Nov 2020 01:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604972512; bh=r+MIkv+sKunzdBRg7xCs73RwWY+TXIWxF+qTLtdXafk=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=El7+2IqGyj8TeRmS2HZqMwaUS6bPjwb8++NkI4Np+rOUyyZfJ5zV8Z/jfMMSDtGNW UFiZhndl5Rgi0Ev4SvLhHCZUD7EE9bvLGhAxIe8uWz12Zozoq6Al+shLbk0PKu1OfS lOv9FWWWmJhOqBtfb/JvdVgKOO0tCGmsrbybMcPU= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id C6E4C35225E9; Mon, 9 Nov 2020 17:41:51 -0800 (PST) Date: Mon, 9 Nov 2020 17:41:51 -0800 From: "Paul E. McKenney" To: Joel Fernandes 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: <20201110014151.GP3249@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20201103142603.1302207-1-joel@joelfernandes.org> <20201103142603.1302207-7-joel@joelfernandes.org> <20201105035713.GL3249@paulmck-ThinkPad-P72> <20201107002604.GA3144506@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201107002604.GA3144506@google.com> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 06, 2020 at 07:26:04PM -0500, Joel Fernandes wrote: > 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. And I have pulled this in, thank you! Thanx, Paul > 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 > > >