Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2331759imm; Sun, 3 Jun 2018 00:52:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLgQN0Rs2uP//bf++oE+IuX8vU1SHOoTnSDAUcV5pGNFXe/mlitanNt7/uSNXawPB5jYly5 X-Received: by 2002:a17:902:3381:: with SMTP id b1-v6mr17307059plc.248.1528012372305; Sun, 03 Jun 2018 00:52:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528012372; cv=none; d=google.com; s=arc-20160816; b=QxPqIW0sB0O2dNL02W4X1buetP2vPcMcAreZf+b18sX258is4yCpTpDdA4bYskks5T buyd899EAcS73C/UhFOI9i3un/7V/+NTcxuEirFXhQ1RJttwCqEliTTSLw3r0k8B8hRS +MVj16uTVdmyB4zEQrsQoIMzzkzUMIHyaXd5da5s4tAyvvm70JzULgnXTc4CXuhIJjMu 5ozPzfWWQU76wrMy64XbwbSMo39bGnxz9bAGv5YdpfN3L32BMMQ3/jOcuHgVTWCH7LHO GEbON+17vr9HHo2fX2I1cnRoKCrBMrmm8yS4OnvOc2oZKdO6R3S7HjIxmTDwHsMEzXCW pH0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=MC9UE8hOdiftfLRV9OdtbTxM9nUilELijYbaYOKAtM0=; b=G/q2S5/gvE5mGcYfFa3JUiLgvRdIsqQ8woQNcG/z2y59ZWg74Sd3YXTDMqPViYRnAQ uAFyjf1oDMtobzK1REbW8SWQtATCeptbAGLYvtSKyb7KFo+QsXKSP8A5lwIT5TQpPtyR 300fwxpebPc41zzgiBKJL2lzMDBnQ5uFY7XuQWoZhwfyS0dZo+ld+YbtSQNQWhtPMvLy +YM6idlcVoV2RyuThJx9Um3Outs58ucO/sm28/D2GmAboRy2Cs1bNBK4INnvgXXxRL/u 3W4uons6b5LuFw3J+Uv93/rdlqW4egKar6JV0okXGwzq+PRGfHE39wdnzQwcWvfjfZEg 6YGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EGiQVDMA; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n4-v6si3207690plp.128.2018.06.03.00.52.02; Sun, 03 Jun 2018 00:52:52 -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=@gmail.com header.s=20161025 header.b=EGiQVDMA; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751057AbeFCHvK (ORCPT + 99 others); Sun, 3 Jun 2018 03:51:10 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:34240 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750847AbeFCHvI (ORCPT ); Sun, 3 Jun 2018 03:51:08 -0400 Received: by mail-lf0-f68.google.com with SMTP id o9-v6so20580151lfk.1 for ; Sun, 03 Jun 2018 00:51:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=MC9UE8hOdiftfLRV9OdtbTxM9nUilELijYbaYOKAtM0=; b=EGiQVDMApzPJoafc4T0LBxUIt/Z47GGigMDYgjy+Lsl31zcJ+ZrpJX2RPVPk7Yacy6 tOGIoqifA6Wmrgw5Gsqdcw7luuLJg2jAWxy729aiDqnwehOXhz6WzpmZlbytBMrzSt9t 2CyHbxIaliiUuSf0fXP8XVPphHU5tfHis0lEWjWotGhvjGqLSPY3lraE9SBFzY/ZMzwE UEmUe2dIoTSLoLs2rZjohX3KSkyTokggf2hNqXOKyr1TyLBIUR/2vt8hToen+uBZ/mbR ZnzHmJ86GEKPVtNSIUbxmKVuRMfwrMPjBOEgy13vO2H3wGlA131RzI2UaNMmc//l/T5Q S92w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=MC9UE8hOdiftfLRV9OdtbTxM9nUilELijYbaYOKAtM0=; b=FVvc6ElxDqxKTBHUZLkGK8BUp9UEz6jTuP0cN0LjLyXxXmddW+Ahk94JvQig/bQNz+ RgWEneKJJ3aq6KUsdLwlkHIFw3VK2Rbq9auwxQmSLQ5wL3ETpSKPpqq68r6BlTa3i0UC en+nFhkTpyewT3rNCHHMvR8UpAoAkpyelPWN4bWPO4BAUhDdMHDjAzhQ0b8k/NIT/os1 pgJczXW7V8MMMlcHypxagYrhv0gn8siOWELMnHhK273ofGu9yEDQliwnsuijLcDcsxpI tk33WPu+m3U3V+m4r2wsm7txL+C8G/w2LIWtRpSHFmeW0OyuBBDzNzVsQ5hJFheLn2Ed /Mnw== X-Gm-Message-State: APt69E30I814bbWx+9lSnpNNa45l7WywVO2+Up9WTvuaVBV9xfy+d2lq 6rBnxwp1rXiBK6wN2LEXRPxXvsWTxUCmc7BKS/o= X-Received: by 2002:a19:9886:: with SMTP id a128-v6mr427043lfe.87.1528012266965; Sun, 03 Jun 2018 00:51:06 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab3:7315:0:0:0:0:0 with HTTP; Sun, 3 Jun 2018 00:51:06 -0700 (PDT) In-Reply-To: <20180603062330.GA153988@joelaf.mtv.corp.google.com> References: <1527818589-13476-1-git-send-email-byungchul.park@lge.com> <20180603035848.GA76941@joelaf.mtv.corp.google.com> <20180603062330.GA153988@joelaf.mtv.corp.google.com> From: Byungchul Park Date: Sun, 3 Jun 2018 16:51:06 +0900 Message-ID: Subject: Re: [PATCH] rcu: Check the range of jiffies_till_{first,next}_fqs when setting them To: Joel Fernandes Cc: Byungchul Park , jiangshanlai@gmail.com, Paul McKenney , josh@joshtriplett.org, rostedt@goodmis.org, Mathieu Desnoyers , linux-kernel@vger.kernel.org, kernel-team@lge.com, kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 3, 2018 at 3:23 PM, Joel Fernandes wrote: > On Sun, Jun 03, 2018 at 02:38:04PM +0900, Byungchul Park wrote: >> On Sun, Jun 3, 2018 at 12:58 PM, Joel Fernandes wrote: >> > 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? >> >> Excuse me. Which code in rcu_init_geometry() makes jiffies_till_first_fqs >> be a non-zero in case called with jiffies_till_first_fqs == 0? > > What do you mean? I think you misunderstood. I didn't say value of 0 is being > handled at boot up. What I said is its initialized to something sane that's > non-zero: > > If you see, jiffies_till_first_fqs is assigned to ULONG_MAX at compile time: > static ulong jiffies_till_first_fqs = ULONG_MAX; > > Then in rcu_init_geometry, we have: > d = RCU_JIFFIES_TILL_FORCE_QS + nr_cpu_ids / RCU_JIFFIES_FQS_DIV; > if (jiffies_till_first_fqs == ULONG_MAX) > jiffies_till_first_fqs = d; > > On my system, jiffies_till_first_fqs is assigned to 3 because of this at > boot. > >> Furthermore, what if we want to change the value through sysfs to zero >> on runtime? > > My patch was just a suggestion. I didn't know if anyone would want to force > it to 0 or not and was wondering what the value in doing so was at the cost > of adding one more function to handle it. It basically says if you set to 0, > that you never want to wait for a timeout before forcing a qs for the first > time? Then why are we calling swait_event_idle_timeout anyway? Wouldn't a > saner timeout be something not zero? I'm sorry I tried but don't understand your point :( Did you happen to read the following? https://lkml.org/lkml/2018/5/29/99 If yes, it would be appreciated if you let me know what I'm missing. -- Thanks, Byungchul