Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2282161imm; Sat, 2 Jun 2018 23:25:40 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJiy6YV2eYqnqkFF0rpL3T55vjK4xHPi2Tb9g4T2QDrLl4GsN0fxZQGTSyfFCupNsAhdTQ+ X-Received: by 2002:a17:902:b81:: with SMTP id 1-v6mr6194487plr.321.1528007140659; Sat, 02 Jun 2018 23:25:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528007140; cv=none; d=google.com; s=arc-20160816; b=CGDeEiBXATbd+39E5tk/MsrgwJxtrHJqOWgYo3Ge6cP8Gbf8ADQPIfjPfQoeufbFkm 7/4RJi28Jk0IqeANOq5tXetHMYVrOFfZIGw888X2soJF8p9ui3B89WGMA2asq2AAJY0T vQTkb//TjjmGGGj8e3r3fkAVntLxbb2yEGUEJzhqxoXav/jrHQForew2JMdxcRT262w6 ZVuuC6U9mm3otpGjyqOn9LeydaFsBZJ4zesQdYWmaa/lYjvA9zMbicq8Wk0Ujf4lBrD8 Z0+OA4mAit/AFjziBdX9nf7SnvaRcO1QU4EfmoqHc9jpzqD3E7YpRXQXqVmegChIUHz0 bEeg== 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=tRZumHHCe0R8ViYvLIaLpZpAEcnAcWCNVVvILb2uevI=; b=l5xBa9MHrU1Jhz9uTRlOMPw2fFWPgfJicv/gmdIIkv6bsKssuCga2/hNl/sJne+dHE RL3TliX2868vLCnDVhG5GQ3iuYXJ6FBmNe4CXBj1NN44i40FgVjeI2gQJG8//VAS6fA4 8ugV+wMu0dnhewZpMXYHfp0++gTPkTpovqlgHtKMU9gm2O0SmSWoDlZi4DQYknE6arfb GEDxUEwlys7LZAGuVePkk/V7/ZtBrMowe+v/Cl4YasJKnQn6UFLOhKojlnBhGgEHchRj qjay/VvBn9fsEDtzFTcHPFu2No6NIaVV6GV5QCwcINJtCAsS9+Z6C1JI48+CtcEWGF2A 5i6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=ZROpAET8; 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 e3-v6si1869902pgn.523.2018.06.02.23.24.26; Sat, 02 Jun 2018 23:25:40 -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=ZROpAET8; 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 S1750981AbeFCGXf (ORCPT + 99 others); Sun, 3 Jun 2018 02:23:35 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33748 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750791AbeFCGXd (ORCPT ); Sun, 3 Jun 2018 02:23:33 -0400 Received: by mail-pg0-f67.google.com with SMTP id e11-v6so3835473pgq.0 for ; Sat, 02 Jun 2018 23:23:33 -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=tRZumHHCe0R8ViYvLIaLpZpAEcnAcWCNVVvILb2uevI=; b=ZROpAET8FKz0YdgAUJWEG/CONZF46Epp+rPSu+9vWF16GyCqd60lXRamZ1cVBnfRcO 0DFQsrqPFayJ4i2Lj2BcPWXvJQeKLRQmoaCdiqEtQy18SH95nlHwQktrIiSQxz6m/vYK I34NRcRPt92gECV3yKVoDjDrSJIkbz86DO940= 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=tRZumHHCe0R8ViYvLIaLpZpAEcnAcWCNVVvILb2uevI=; b=gG7wkw3/yDXfH6iYudx/K3jZ5fd14M6JbtrjwY3rNZc+eo6aQ0Db0D61sljGIMfRcC lIfkqXcUQYsi8MABVRgJQdgobkz6Qhh1IIWtS/8bWtnowCMpVQHGtqSuo3yQEI66uj12 EHSrZPXktJi3lAMJixDukF4WxEb1fgfKJVxTunXpBanr6pYu9I0i1CyGy0EloMgtEjns k7T117Jzd0vhnnwtelomE1RfNUdD79bwd13nhxXu5zYLaNJ1EFG9nRg+i4Z5v9dx0Nx/ Bl0vVSK81CbjSbMaguVzL2SfVfXF3hejyOIegf95t5d0PNpMIU0Z1vAhOVjIrvoL9Ds6 B/bQ== X-Gm-Message-State: ALKqPwei+WHCThliBYwzK6oJW+CyyVlA2TufyZk+ofRtrVNWPQnRhHA4 CdNEvdfvcFf7FhcWeulRf5cmIg== X-Received: by 2002:a65:418b:: with SMTP id a11-v6mr13564635pgq.118.1528007013272; Sat, 02 Jun 2018 23:23:33 -0700 (PDT) Received: from localhost ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id n10-v6sm98410270pfj.68.2018.06.02.23.23.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 02 Jun 2018 23:23:32 -0700 (PDT) Date: Sat, 2 Jun 2018 23:23:30 -0700 From: Joel Fernandes To: Byungchul Park 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 Subject: Re: [PATCH] rcu: Check the range of jiffies_till_{first,next}_fqs when setting them Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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? thanks, - Joel