Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4710256imm; Mon, 14 May 2018 11:37:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrG4koKKYmBu1ndZ/EKohjQqiNR0HMJy7h3+NWHKTSfLpKqjwETLa7n1TNqV0VHEdtrNPHw X-Received: by 2002:a62:ea1a:: with SMTP id t26-v6mr11724108pfh.117.1526323050968; Mon, 14 May 2018 11:37:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526323050; cv=none; d=google.com; s=arc-20160816; b=IGxgz8pKzG96YYQHEFYrST4Weh6Vv+gSOvw/XwgPaWXfeQ85w1QqnAjgywU2lir2vf M+RSMxHWShvnyA1DzPnSRSrE22wH2hQaY5TKcCW4Iw89BvyCrlXkFLRCOOWz8oDMHRUi 4/4dnOPixx75FvhTOxEX6E6qXf6Cn3vYVgov7rdOEE1RytrwAPyH5BRjAElT9BF7AXmv DFdbsRN0q+rJ0CoixiucGzqrlzJqiWL/F9PIYFlV0doZ0282GGX4qIvw16j3Jtb0mm93 MO8zpYCUTvoR+K/jgPkW4pSnhrB854PHhDc2fdOULTKfsPA8h+8ZTOCT8lWoRPoO0gdC Oi1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date:arc-authentication-results; bh=muw/YtiYi40y7apZuHegH/qwXEtDUDzSKUvGXHhH4HU=; b=diSN4706Z9W7xZn5uNfff97osd/Kh+OjWJQgMsP10HpVskbWGerH272rPalyb5zXWk Pf9fFLiemGoYx8OQO4CO026OT4hDJKuk4jhCfsiiFByJcaG+4rvDcj4/8I8jfmOAryxC 3l0dxGwTC7MQnxoOgjUnt4veNNoGB/YnVYdj17dJhWqWpcXtcWbG9Y+lIX7jM+vpzOgP SiOv0JjF4Swx0Jt31zBC2brLM7+W6dt/3joucKzgcE9BYcOaQUMFnK9oGi09SlenXxS0 sMc3NGi6tD+qEx6LFG7J15J0V1pyepBSNC4YmEV6H/yF0p11sVss3eLqvM1gqjRBw/xH L0qg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2-v6si8118197pgs.349.2018.05.14.11.37.15; Mon, 14 May 2018 11:37:30 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752049AbeENSg7 (ORCPT + 99 others); Mon, 14 May 2018 14:36:59 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59608 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751498AbeENSg6 (ORCPT ); Mon, 14 May 2018 14:36:58 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4EIXpSt013500 for ; Mon, 14 May 2018 14:36:57 -0400 Received: from e18.ny.us.ibm.com (e18.ny.us.ibm.com [129.33.205.208]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hycrxrgme-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 14 May 2018 14:36:57 -0400 Received: from localhost by e18.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 14 May 2018 14:36:56 -0400 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e18.ny.us.ibm.com (146.89.104.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 14 May 2018 14:36:52 -0400 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4EIaq5J57606218; Mon, 14 May 2018 18:36:52 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1AC89B204E; Mon, 14 May 2018 15:38:50 -0400 (EDT) Received: from paulmck-ThinkPad-W541 (unknown [9.70.82.108]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP id BBC2CB204D; Mon, 14 May 2018 15:38:49 -0400 (EDT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 447BD16C3308; Mon, 14 May 2018 11:38:23 -0700 (PDT) Date: Mon, 14 May 2018 11:38:23 -0700 From: "Paul E. McKenney" To: "Joel Fernandes (Google)" Cc: linux-kernel@vger.kernel.org, Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , byungchul.park@lge.com, kernel-team@android.com Subject: Re: [PATCH RFC 6/8] rcu: Add back the Startedleaf tracepoint Reply-To: paulmck@linux.vnet.ibm.com References: <20180514031541.67247-1-joel@joelfernandes.org> <20180514031541.67247-7-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180514031541.67247-7-joel@joelfernandes.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 18051418-0044-0000-0000-00000414264D X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009025; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000260; SDB=6.01032285; UDB=6.00527725; IPR=6.00811416; MB=3.00021110; MTD=3.00000008; XFM=3.00000015; UTC=2018-05-14 18:36:54 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18051418-0045-0000-0000-0000084639D7 Message-Id: <20180514183823.GF26088@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-14_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805140187 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 13, 2018 at 08:15:39PM -0700, Joel Fernandes (Google) wrote: > In recent discussion [1], the check for whether a leaf believes RCU is > not idle, is being added back to funnel locking code, to avoid more > locking. In this we are marking the leaf node for a future grace-period > and bailing out since a GP is currently in progress. However the > tracepoint is missing. Lets add it back. > > Also add a small comment about why we do this check (basically the point > is to avoid locking intermediate nodes unnecessarily) and clarify the > comments in the trace event header now that we are doing traversal of > one or more intermediate nodes. > > [1] http://lkml.kernel.org/r/20180513190906.GL26088@linux.vnet.ibm.com > > Signed-off-by: Joel Fernandes (Google) Looks like a good idea, but it does not apply -- which is not a surprise, given the change rate in this code. I hand-applied as a modification to c1b3f9fce26f ("rcu: Don't funnel-lock above leaf node if GP in progress") with attribution, but with the changes below. Please let me know if I am missing something. Ah, I see -- this commit depends on your earlier name-change commit. I therefore made this patch use the old names. > --- > include/trace/events/rcu.h | 4 ++-- > kernel/rcu/tree.c | 11 ++++++++++- > 2 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h > index 539900a9f8c7..dc0bd11739c7 100644 > --- a/include/trace/events/rcu.h > +++ b/include/trace/events/rcu.h > @@ -91,8 +91,8 @@ TRACE_EVENT(rcu_grace_period, > * > * "Startleaf": Request a grace period based on leaf-node data. > * "Prestarted": Someone beat us to the request > - * "Startedleaf": Leaf-node start proved sufficient. > - * "Startedleafroot": Leaf-node start proved sufficient after checking root. > + * "Startedleaf": Leaf and one or more non-root nodes marked for future start. Actually, we only get to that trace if all we did was mark the leaf node, right? > + * "Startedleafroot": all non-root nodes from leaf to root marked for future start. I got rid of the "non-root" part, given that we had to have marked the root to break out of the loop. Thanx, Paul > * "Startedroot": Requested a nocb grace period based on root-node data. > * "NoGPkthread": The RCU grace-period kthread has not yet started. > * "StartWait": Start waiting for the requested grace period. > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > index 40670047d22c..8401a253e7de 100644 > --- a/kernel/rcu/tree.c > +++ b/kernel/rcu/tree.c > @@ -1593,8 +1593,17 @@ static bool rcu_start_this_gp(struct rcu_node *rnp, struct rcu_data *rdp, > goto unlock_out; > } > rnp_node->gp_seq_needed = gp_seq_start; > - if (rcu_seq_state(rcu_seq_current(&rnp->gp_seq))) > + > + /* > + * Check if leaf believes a GP is in progress, if yes we can > + * bail and avoid more locking. We have already marked the leaf. > + */ > + if (rcu_seq_state(rcu_seq_current(&rnp->gp_seq))) { > + trace_rcu_this_gp(rnp_node, rdp, gp_seq_start, > + TPS("Startedleaf")); > goto unlock_out; > + } > + > if (rnp_node != rnp && rnp_node->parent != NULL) > raw_spin_unlock_rcu_node(rnp_node); > if (!rnp_node->parent) { > -- > 2.17.0.441.gb46fe60e1d-goog >