Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2201440imm; Sat, 2 Jun 2018 21:00:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL6UwvR4majOzl5zyyS5J1MOOlzGZ0RP2+/4BRpf9SDzZwMjvBHdn3NFQMcfbF0OrkMXhv9 X-Received: by 2002:a63:3581:: with SMTP id c123-v6mr8733806pga.217.1527998446099; Sat, 02 Jun 2018 21:00:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527998446; cv=none; d=google.com; s=arc-20160816; b=q9E/pousu8MFJ+54YmuqTKSLOSZ+LlDLQ/nz5vhZonlbhdCrjP/UMnjp/qM5sJSorR hdwlrT3nYryziH13tOZfrwlNwcR4XIaeoJUU4cUfV6SQoWJ+1etunHWLUh3pRZxZvzAI OLVq+auyvJHFoU9cEsN+2/ny4X2xKpXlbfZRJ5eB0I8GBFzFXsheLTP1EUG7Y4+MK5UB CDpp10joxyX9Y4Kh526rf0725IIbNbqeD7FMyjHmBx7y/Fr++saK899S/HTZb81eCIpp S8y4/2QEvHOmIXOBgvq+KF8FdoUDeCJSzOoRJoJwaS5XcfT+niCZ3naX3lwE5Tfzsvxy Vbjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=xc5TuImsArayV3fgKpI8eN3eOcZRrzkRR0UToLkTlQE=; b=pdjYT8KeyCMpj/BCjzKiCxZQyxTyD/mQ4HnAb/C4M791eb23AyOTVaHICWWvon4Ks1 n+aONlM72bd2+nIlNgz16IlJuBDz0BgVhTjXeZba3/qcT4XbK4RyhrLOK2rBiYIbZ3bC OP9jRKtineF/VTToI+a8vWT4cDaZmf1PyxxsHwA25a7WntV80AcmvJDzZ4UJtHOBZqCk lQdxTbTm7IkNFTucgCPHAW1eB8v0TNlpvjMCk0qL2qcNcqDCuaKv2HgQSF28Lc39DQOp Fr5Wpp/QsWHtfj11hfKUwdF2v75s8O45LuczSwt6jASF1JFuiqulyGhli/J+HOvxzHLh 1qTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=VBv0h0ik; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=joelfernandes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x20-v6si42773685pln.235.2018.06.02.20.59.50; Sat, 02 Jun 2018 21:00:46 -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; dkim=pass header.i=@joelfernandes.org header.s=google header.b=VBv0h0ik; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=joelfernandes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751005AbeFCD6x (ORCPT + 99 others); Sat, 2 Jun 2018 23:58:53 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:33876 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750913AbeFCD6v (ORCPT ); Sat, 2 Jun 2018 23:58:51 -0400 Received: by mail-pg0-f65.google.com with SMTP id k2-v6so12959088pgc.1 for ; Sat, 02 Jun 2018 20:58:51 -0700 (PDT) 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:user-agent; bh=xc5TuImsArayV3fgKpI8eN3eOcZRrzkRR0UToLkTlQE=; b=VBv0h0ikpWZy3DDcIRyJoxMATvm7MaBcYVr8KcWQBBezyn/1vvh8ZLCsPmQtN95XVH PcU+rB9jRN/NCgVfb8POzp/H8Z88Jqxi9ItYUxUvq1R7EB/AO/mqkrSubaDcx2Y6r54j ZGuS+8zlYk3DK5NG7RUcC+/TUB0lkJLScCLQk= 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:user-agent; bh=xc5TuImsArayV3fgKpI8eN3eOcZRrzkRR0UToLkTlQE=; b=sezCRTiRzR8Z5MEpKZV6FPXd+QDCT9MOV54oXrW+YrZiBXHD2MCHm/M6jQ/yqLd7BF uuvk0bGI8Z+Lh6CCw3+EKkYlYcHgdMQu6htEXrL3nekhtjg9WFSwmgmS9PZi8ZvVBUL0 GTncdPFe397cp/ZTVBtdlfWNByw8e16b2I1oaJLwb1859E3OWcHE6nNbRD8OZcPk4k2/ oxWVJtZfpF0IlY4Z3H9b/IxRf4t6X1EoERZAqfBmmFMZCtawyT4Uhmm7jwvca4pGfSHK l5Ximxs76dYmWhf5lpHv71f+o0M0sBvedhLMQcEdOofeiiCPerDBZCrmxAGA/ZsUqNQv QRdQ== X-Gm-Message-State: APt69E3FZfxeyRKWBaWCdM/OEPqixXcL1vE7cKRH8eO9i1vBWfS6Enhe ktmN6IJUbEKjy0heeCYL2ewa3Q== X-Received: by 2002:a63:7906:: with SMTP id u6-v6mr5052974pgc.284.1527998331237; Sat, 02 Jun 2018 20:58:51 -0700 (PDT) Received: from localhost ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id m83-v6sm15439659pfi.188.2018.06.02.20.58.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 02 Jun 2018 20:58:50 -0700 (PDT) Date: Sat, 2 Jun 2018 20:58:48 -0700 From: Joel Fernandes To: Byungchul Park Cc: jiangshanlai@gmail.com, paulmck@linux.vnet.ibm.com, josh@joshtriplett.org, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, linux-kernel@vger.kernel.org, kernel-team@lge.com, kernel-team@android.com Subject: Re: [PATCH] rcu: Check the range of jiffies_till_{first,next}_fqs when setting them Message-ID: <20180603035848.GA76941@joelaf.mtv.corp.google.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.9.2 (2017-12-15) 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 > --- > 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; > +} Reviewed-by: Joel Fernandes (Google) Also, can we not combine the 2 param_set_ handlers as well? Only thing we would be giving up is that jiffies_till_first_fqs = 0 wouldn't be allowed (if we go with the param_set_next handler to be the common one) but don't think that's a useful/valid usecase since jiffies_till_first_fqs is set to a sane non-0 value anyway at boot up because of rcu_init_geometry anyway.. Thoughts? If you agree, the below patch could be applied on top of rcu/dev (tested on rcu/dev), it saves another 20 lines. thanks, - Joel ---8<----------------------- From: "Joel Fernandes (Google)" Date: Sat, 2 Jun 2018 20:47:06 -0700 Subject: [PATCH] rcu: Use common handler for setting jiffies_till_{first,next}_fqs Recently the checking of jiffies_till_{first,next}_fqs during forcing of quiescent states was changed to be done whenever the parameters are set. Looking at how jiffies_till_first_fqs is used on my system, I noticed a value of 0 for it doesn't make much sense and is infact set to a non-0 value at boot up. In this case, we can combine the module_param handlers for setting both these and keep code size small. This patch attempts it. Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index deb2508be923..6550040f8d46 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -498,17 +498,7 @@ static ulong jiffies_till_first_fqs = ULONG_MAX; static ulong jiffies_till_next_fqs = ULONG_MAX; static bool rcu_kick_kthreads; -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) +static int param_set_fqs_jiffies(const char *val, const struct kernel_param *kp) { ulong j; int ret = kstrtoul(val, 0, &j); @@ -518,18 +508,13 @@ static int param_set_next_fqs_jiffies(const char *val, const struct kernel_param 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, +static struct kernel_param_ops fqs_jiffies_ops = { + .set = param_set_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_cb(jiffies_till_first_fqs, &fqs_jiffies_ops, &jiffies_till_first_fqs, 0644); +module_param_cb(jiffies_till_next_fqs, &fqs_jiffies_ops, &jiffies_till_next_fqs, 0644); module_param(rcu_kick_kthreads, bool, 0644); /* -- 2.17.1.1185.g55be947832-goog