Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp379233ybc; Tue, 19 Nov 2019 02:57:05 -0800 (PST) X-Google-Smtp-Source: APXvYqw05ymtBnq9PjzIm0q3Jg7WoIXgHiuCDwZQ5ivH+9gLMtGfmdsYDPKONsVEY/QVeTiHlkgQ X-Received: by 2002:a17:906:1d02:: with SMTP id n2mr33897558ejh.219.1574161025296; Tue, 19 Nov 2019 02:57:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574161025; cv=none; d=google.com; s=arc-20160816; b=Qtl3iOaurtoipoa45YTLWSm+msdirKUXBeI6FybHZVe628uuh9QvhW15yOWpTNTqVY CPS62EUvor1/rcQB1NwqcZwz+YjOdGcjzkt5gEsJWdMitKc2QNuxGs2uCAvOa1Z6FweE 2fljO+hJjC8aeRX25lg9Z7rQ9SBYk4Claa0K4dpJqHDbLtUNP5Kbd0iV39BnthiRbuco 3iZr+MzM7AJYE8wEYitj1HwZNJLIa0RGrGboo+i1ii2RDqWjq7XokBO7rdgJpbEaw6wv yW3mowtsW/OipfEU9yL5Ye4nNXVGIP1CeiSBaqNkxWxdylp4/kBbUnErnDtGxJNW1J0j h5eQ== 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 :in-reply-to:references:mime-version:dkim-signature; bh=dy5ixUlyf68dNjAjwb1L9Qd0I2zb6jWFc6s6RugNUDI=; b=rgVhf9iKhvce4f8Dy0diM7WMXPolY190NKAn69rFhC9v4bFzcc2u6sU4d9JY8LDsao l623QlPIWOo+g/h0meR68X1nWBXkUtG9EW3gZKMAthf427jmv7qJU9irh/87bz2RpJbh rKEwdCrYvBg8LK72y1Ve0fh46PSUBXpSeR7RxfxQHgEGn26DGrnrfNzBgSsFsQXXzqmf F6ph3NwGAXxuGJXgK69MgeAM7JScUgLK9UI8PwpfEAQHE/UkvT47kSWoRkBAG7YIGTmN Jcjfwdtp4VB2Fel56Wgtx6+JfwYQ4jmYMw5WTvKjZB7wsloUOs9NKo9l6rwTf/eAwI/B i/2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@verdurent-com.20150623.gappssmtp.com header.s=20150623 header.b="OMvg4l6/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n20si3140323ejk.351.2019.11.19.02.56.40; Tue, 19 Nov 2019 02:57:05 -0800 (PST) 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=@verdurent-com.20150623.gappssmtp.com header.s=20150623 header.b="OMvg4l6/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727728AbfKSKwZ (ORCPT + 99 others); Tue, 19 Nov 2019 05:52:25 -0500 Received: from mail-ua1-f67.google.com ([209.85.222.67]:37048 "EHLO mail-ua1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726921AbfKSKwZ (ORCPT ); Tue, 19 Nov 2019 05:52:25 -0500 Received: by mail-ua1-f67.google.com with SMTP id l38so6353336uad.4 for ; Tue, 19 Nov 2019 02:52:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=verdurent-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dy5ixUlyf68dNjAjwb1L9Qd0I2zb6jWFc6s6RugNUDI=; b=OMvg4l6/1nsKABdXlt6h8gh6Ym39dQDfCvdV1DQvdd7dawW+KxDoRvRZeVw0FkljC4 SugleFom8jwSWziUC3QsDJXAJmSNposL+3wlshDhjjcM1JocsT7yofbGIV9Yeni2hvoV x/nNjf0ta5tkSY4qElrafJIYPqaXIK5rPafmlTchKiJQ1ouCffEGvOPxVlHEYAs/X+XO JMmY8rY5sicmIeZF7qIduSnYd6cTmkx1YrCWTbCl1Jvgmy67j8/TXem/BKABWoKd3Xs9 P0EpN/0bQZYdL92BxxOVilcKQS/nodBmxum/GCCiTmAcGnGml3KgCPO3ELLusEqVwV63 lyLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dy5ixUlyf68dNjAjwb1L9Qd0I2zb6jWFc6s6RugNUDI=; b=CXFjqL3twG61FGqJoB5uR3NedrYtXU5DKiBfkuiFMDUYEJkp0rbvji4L5AZERbW9xs OsQEErYShfqOI50UePSbJbJyDQyoi73z++7x8zb2dbEe7JkeUTXTJzvb1PiRKZAlBfv6 DZXCNdwryYmPXFakOoxdKRPCuEVRmzsCKoEBn5/OCYFQ0xexiQErRQfqGKK6ol/edJkn g0GRX4nPMvYM5wscjqtHCs2dgGvo7QChWQwfgLfcuv42G5w9QlPGZehtWlEd9fR/jAUv MOpoUF2HmRKm4ubBkaagCeRM+Y5mDuR8ZkqQdM/IFeWQkRz62XYnpsM8mtPKAsh60ZIY elnA== X-Gm-Message-State: APjAAAXTDhbcGSumPGvYMtYrtP9ZwgoKBF2rzU+kNKwb8BpirszdJWA5 RPmuDKzDWYcyaJ4Q/D+4a6cyzJJwoF/giVSQJ8oKaQ== X-Received: by 2002:a9f:364c:: with SMTP id s12mr19811993uad.77.1574160743379; Tue, 19 Nov 2019 02:52:23 -0800 (PST) MIME-Version: 1.0 References: <1572979786-20361-1-git-send-email-thara.gopinath@linaro.org> <1572979786-20361-7-git-send-email-thara.gopinath@linaro.org> In-Reply-To: <1572979786-20361-7-git-send-email-thara.gopinath@linaro.org> From: Amit Kucheria Date: Tue, 19 Nov 2019 16:22:12 +0530 Message-ID: Subject: Re: [Patch v5 6/6] sched/fair: Enable tuning of decay period To: Thara Gopinath Cc: Ingo Molnar , Peter Zijlstra , ionela.voinescu@arm.com, Vincent Guittot , Zhang Rui , Eduardo Valentin , qperret@google.com, LKML , Amit Daniel Kachhap , Javi Merino , Daniel Lezcano 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 Wed, Nov 6, 2019 at 12:20 AM Thara Gopinath wrote: > > Thermal pressure follows pelt signas which means the > decay period for thermal pressure is the default pelt > decay period. Depending on soc charecteristics and thermal > activity, it might be beneficial to decay thermal pressure > slower, but still in-tune with the pelt signals. > One way to achieve this is to provide a command line parameter > to set a decay shift parameter to an integer between 0 and 10. > > Signed-off-by: Thara Gopinath > --- > > v4->v5: > - Changed _coeff to _shift as per review comments on the list. > > Documentation/admin-guide/kernel-parameters.txt | 5 +++++ > kernel/sched/fair.c | 25 +++++++++++++++++++++++-- > 2 files changed, 28 insertions(+), 2 deletions(-) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index c82f87c..0b8f55e 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -4281,6 +4281,11 @@ > incurs a small amount of overhead in the scheduler > but is useful for debugging and performance tuning. > > + sched_thermal_decay_shift= > + [KNL, SMP] Set decay shift for thermal pressure signal. > + Format: integer betweer 0 and 10 > + Default is 0. > + > skew_tick= [KNL] Offset the periodic timer tick per cpu to mitigate > xtime_lock contention on larger systems, and/or RCU lock > contention on all systems with CONFIG_MAXSMP set. > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 5f6c371..61a020b 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -91,6 +91,18 @@ const_debug unsigned int sysctl_sched_migration_cost = 500000UL; > * and maximum available capacity due to thermal events. > */ > static DEFINE_PER_CPU(unsigned long, thermal_pressure); > +/** > + * By default the decay is the default pelt decay period. > + * The decay shift can change the decay period in > + * multiples of 32. > + * Decay shift Decay period(ms) > + * 0 32 > + * 1 64 > + * 2 128 > + * 3 256 > + * 4 512 > + */ > +static int sched_thermal_decay_shift; > > static void trigger_thermal_pressure_average(struct rq *rq); > > @@ -10435,6 +10447,15 @@ void update_thermal_pressure(int cpu, unsigned long capped_capacity) > delta = arch_scale_cpu_capacity(cpu) - capped_capacity; > per_cpu(thermal_pressure, cpu) = delta; > } > + > +static int __init setup_sched_thermal_decay_shift(char *str) > +{ > + if (kstrtoint(str, 0, &sched_thermal_decay_shift)) > + pr_warn("Unable to set scheduler thermal pressure decay shift parameter\n"); You're reading straight from the cmdline into a kernel variable w/o any bounds checking. Perhaps use clamp or clamp_val to make sure it is between 0 and 10? > + > + return 1; > +} > +__setup("sched_thermal_decay_shift=", setup_sched_thermal_decay_shift); > #endif > > /** > @@ -10444,8 +10465,8 @@ void update_thermal_pressure(int cpu, unsigned long capped_capacity) > static void trigger_thermal_pressure_average(struct rq *rq) > { > #ifdef CONFIG_SMP > - update_thermal_load_avg(rq_clock_task(rq), rq, > - per_cpu(thermal_pressure, cpu_of(rq))); > + update_thermal_load_avg(rq_clock_task(rq) >> sched_thermal_decay_shift, > + rq, per_cpu(thermal_pressure, cpu_of(rq))); > #endif > } > > -- > 2.1.4 >