Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1599131imm; Sat, 2 Jun 2018 04:47:54 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJfxrAmrImDWoxO69cnPLUbsVIbu0ygOAXHLAUSp6FQxrbamlhEGupuQjNsIRYg4xSbeAaI X-Received: by 2002:a17:902:7d89:: with SMTP id a9-v6mr14484150plm.238.1527940074250; Sat, 02 Jun 2018 04:47:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527940074; cv=none; d=google.com; s=arc-20160816; b=i5v9AApru+U93E0uTmcNVt3U+PNofsDplwJHu6NHOuMPsnz7kZm+lVI/j+9GgXasBS gZ5uLkFfqBAr1RFyHOkvW0KTKlfWIW1D74metWBc7SYJra4yx1kfRPLTd/2H5Rwz1vfj og5ZhuZJmjxKUy9YgDADU5dvGRhZ/cUb/cJ4qz/HnSZ5SxNSdqHgo9r0gxqNmyDXxKES e6mR5isHarAXZbbJeTscHroavjClnBiuuSD+BCGESujj6srCbsQSkMrZMNinNv6J+s8O MspqqztxokllnGLEAErtLjNEfJzr4UHlMObm6WsVBoMquPpV5URa8ZwnBKbE85Fwfv5j MRog== 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=PL4y1AllYStpU+UwMMna5MgUCIXSAOyohnfqsTBFnLQ=; b=1DlEZpbiopMM2Nu89tbI6TPsbFXF+OSj8rDdutXWm9XaXzyyRhBUfog5qVofNTguTU ExRmCo79ko86DZGxebelHomCohosnIym3XOHeV2fMKGyE020LDFy9avQjUIZCE2+M1X3 AUfYAw1K/VdZV82zmp/tcZai4BMxqtx7tEgRT7IDxjjcbh1K5Ir+YnQC9vxIMQEsY+lg jmUgscZi36PfCM2EJulfrPnoGKd1ZlQD0auNOVKz+/kn6dqfRXP4ds/cujK0l+TAuA7r 3Xd/0Duoj+NfGqdcpdadRqt6ELAPNYGwJrUwZmYAa8qfsIH1F195Z84ieMD9K7ST36Cd kKVg== 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 r63-v6si40924469plb.366.2018.06.02.04.47.39; Sat, 02 Jun 2018 04:47:54 -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 S1751502AbeFBLno (ORCPT + 99 others); Sat, 2 Jun 2018 07:43:44 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:35128 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750892AbeFBLnn (ORCPT ); Sat, 2 Jun 2018 07:43:43 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w52BdPXu104228 for ; Sat, 2 Jun 2018 07:43:42 -0400 Received: from e14.ny.us.ibm.com (e14.ny.us.ibm.com [129.33.205.204]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jbqremc05-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 02 Jun 2018 07:43:42 -0400 Received: from localhost by e14.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 2 Jun 2018 07:43:41 -0400 Received: from b01cxnp22033.gho.pok.ibm.com (9.57.198.23) by e14.ny.us.ibm.com (146.89.104.201) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sat, 2 Jun 2018 07:43:37 -0400 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w52Bha3810027344 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 2 Jun 2018 11:43:36 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 85522B2065; Sat, 2 Jun 2018 08:45:13 -0400 (EDT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 57DB1B2064; Sat, 2 Jun 2018 08:45:13 -0400 (EDT) Received: from paulmck-ThinkPad-W541 (unknown [9.85.206.50]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Sat, 2 Jun 2018 08:45:13 -0400 (EDT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 818E716C651B; Sat, 2 Jun 2018 04:45:22 -0700 (PDT) Date: Sat, 2 Jun 2018 04:45:22 -0700 From: "Paul E. McKenney" To: Byungchul Park Cc: jiangshanlai@gmail.com, josh@joshtriplett.org, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, linux-kernel@vger.kernel.org, kernel-team@lge.com, joel@joelfernandes.org Subject: Re: [PATCH] rcu: Check the range of jiffies_till_{first,next}_fqs when setting them Reply-To: paulmck@linux.vnet.ibm.com References: <1527818589-13476-1-git-send-email-byungchul.park@lge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1527818589-13476-1-git-send-email-byungchul.park@lge.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 18060211-0052-0000-0000-000002F67845 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009115; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01041197; UDB=6.00533045; IPR=6.00820326; MB=3.00021425; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-02 11:43:40 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060211-0053-0000-0000-00005CDE1ADF Message-Id: <20180602114522.GH3593@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-02_07:,, 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 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806020138 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 01, 2018 at 11:03:09AM +0900, Byungchul Park wrote: > Currently, the range of jiffies_till_{first,next}_fqs are checked and > adjusted on and on in the loop of rcu_gp_kthread on runtime. > > However, it's enough to check them only when setting them, not every > time in the loop. So make them handled on a setting time via sysfs. > > Signed-off-by: Byungchul Park Applied for further review and testing, thank you! Thanx, Paul > --- > kernel/rcu/tree.c | 45 ++++++++++++++++++++++++++++++++------------- > 1 file changed, 32 insertions(+), 13 deletions(-) > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > index 4e96761..eb54d7d 100644 > --- a/kernel/rcu/tree.c > +++ b/kernel/rcu/tree.c > @@ -518,8 +518,38 @@ void rcu_all_qs(void) > static ulong jiffies_till_next_fqs = ULONG_MAX; > static bool rcu_kick_kthreads; > > -module_param(jiffies_till_first_fqs, ulong, 0644); > -module_param(jiffies_till_next_fqs, ulong, 0644); > +static int param_set_first_fqs_jiffies(const char *val, const struct kernel_param *kp) > +{ > + ulong j; > + int ret = kstrtoul(val, 0, &j); > + > + if (!ret) > + WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : j); > + return ret; > +} > + > +static int param_set_next_fqs_jiffies(const char *val, const struct kernel_param *kp) > +{ > + ulong j; > + int ret = kstrtoul(val, 0, &j); > + > + if (!ret) > + WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : (j ?: 1)); > + return ret; > +} > + > +static struct kernel_param_ops first_fqs_jiffies_ops = { > + .set = param_set_first_fqs_jiffies, > + .get = param_get_ulong, > +}; > + > +static struct kernel_param_ops next_fqs_jiffies_ops = { > + .set = param_set_next_fqs_jiffies, > + .get = param_get_ulong, > +}; > + > +module_param_cb(jiffies_till_first_fqs, &first_fqs_jiffies_ops, &jiffies_till_first_fqs, 0644); > +module_param_cb(jiffies_till_next_fqs, &next_fqs_jiffies_ops, &jiffies_till_next_fqs, 0644); > module_param(rcu_kick_kthreads, bool, 0644); > > /* > @@ -2129,10 +2159,6 @@ static int __noreturn rcu_gp_kthread(void *arg) > /* Handle quiescent-state forcing. */ > first_gp_fqs = true; > j = jiffies_till_first_fqs; > - if (j > HZ) { > - j = HZ; > - jiffies_till_first_fqs = HZ; > - } > ret = 0; > for (;;) { > if (!ret) { > @@ -2167,13 +2193,6 @@ static int __noreturn rcu_gp_kthread(void *arg) > WRITE_ONCE(rsp->gp_activity, jiffies); > ret = 0; /* Force full wait till next FQS. */ > j = jiffies_till_next_fqs; > - if (j > HZ) { > - j = HZ; > - jiffies_till_next_fqs = HZ; > - } else if (j < 1) { > - j = 1; > - jiffies_till_next_fqs = 1; > - } > } else { > /* Deal with stray signal. */ > cond_resched_tasks_rcu_qs(); > -- > 1.9.1 >