Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4128305ybx; Mon, 4 Nov 2019 08:16:20 -0800 (PST) X-Google-Smtp-Source: APXvYqxxC1wrpQJr9czCmNVzq+fFn1eLAaS2/XsYQXofnm7vHqMRFnvEK/UTTMGNFv6gfjJoZik3 X-Received: by 2002:a50:b3b6:: with SMTP id s51mr30389590edd.88.1572884180853; Mon, 04 Nov 2019 08:16:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572884180; cv=none; d=google.com; s=arc-20160816; b=qrM0sX47ruFfyzYcnuZP4PT9EkGNCWTCO2tSg1ru7ErtDZKJC/sF3X+jzVbeXLEc43 l3hXfD0Byw2X21+1elDpVz5V9MO3TJlOFKJ50bT1LC+SEUwGKL4UtQcwFlJs58rv0JaD dJSyY1FqkLMKvF6EMEm/FC56djSrYT2TbyMYJk18FN7xQ3ajjBk6w5tx9YECgJFTuHn2 HtcVfXRLjtqGZZzicJKYvbgir4EMZVxoh/f35tKcTJjzsOQA4V2gnzbU2C59NeNGLmGJ E7KkHJ4aC/KLdDrCMYs6kqf2n0kHD5/Op7y29UJuULhwjF+WWv4c19qbVvw+F8RQBwJs Yyyg== 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; bh=RACC7HMNpBI1KCx66rsq/GwttjB5xADqp1VVfwkSt9s=; b=MklMQwOTYVVxPAIc1zITnYECcSwwkWxQcYs5EV5QdAnN5cjI/iwVkV9Kb5MoBf2AxJ fnd0/Ilpdrfm0pYPZVA/Svk4o6eqaOe3MyGNQMwec8xKgdzMb8o1gytyjhGUK32i7Det 4YwdHcYWqlHmBLE18Q32FiIUyStU+V8loDiRGdkwmramq3MzwqKDrquBVvZJsrozbYlZ 6UV270RFIxni7TamAKR7yr7wFOFrSvvnUWX/ZL5ERk4c1unl1uBo1/dJHD3exa9y5qfW kvqehcKleeja4Y5O7pvhTMq2U76q97v3Ds2DtjE788I4bgsfQMM0kyp+xTBSVhjB4WQL Q3ng== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s24si9898635ejz.252.2019.11.04.08.15.57; Mon, 04 Nov 2019 08:16:20 -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; 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 S1729321AbfKDQMR (ORCPT + 99 others); Mon, 4 Nov 2019 11:12:17 -0500 Received: from foss.arm.com ([217.140.110.172]:46260 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728287AbfKDQMR (ORCPT ); Mon, 4 Nov 2019 11:12:17 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A41E91FB; Mon, 4 Nov 2019 08:12:16 -0800 (PST) Received: from localhost (e108754-lin.cambridge.arm.com [10.1.199.68]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 449153F71A; Mon, 4 Nov 2019 08:12:16 -0800 (PST) Date: Mon, 4 Nov 2019 16:12:14 +0000 From: Ionela Voinescu To: Thara Gopinath Cc: mingo@redhat.com, peterz@infradead.org, vincent.guittot@linaro.org, rui.zhang@intel.com, edubezval@gmail.com, qperret@google.com, linux-kernel@vger.kernel.org, amit.kachhap@gmail.com, javi.merino@kernel.org, daniel.lezcano@linaro.org Subject: Re: [Patch v4 6/6] sched: thermal: Enable tuning of decay period Message-ID: <20191104161035.GA6680@e108754-lin> References: <1571776465-29763-1-git-send-email-thara.gopinath@linaro.org> <1571776465-29763-7-git-send-email-thara.gopinath@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1571776465-29763-7-git-send-email-thara.gopinath@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thara, On Tuesday 22 Oct 2019 at 16:34:25 (-0400), 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. I wonder if it can be beneficial to decay thermal pressure faster as well. This implementation makes 32 (LOAD_AVG_PERIOD) the minimum half-life of the thermal pressure samples. This results in more than 100ms for a sample to decay significantly and therefore let's say it can take more than 100ms for capacity to return to (close to) max when the CPU is no longer capped. This value seems high to me considering that a minimum value should result in close to 'instantaneous' behaviour, when there are thermal capping mechanisms that can react in ~20ms (hikey960 has a polling delay of 25ms, if I'm remembering correctly). I agree 32ms seems like a good default but given that you've made this configurable as to give users options, I'm wondering if it would be better to cover a wider range. > One way to achieve this is to provide a command line parameter > to set the decay coefficient to an integer between 0 and 10. > > Signed-off-by: Thara Gopinath > --- > v3->v4: > - Removed the sysctl setting to tune decay period and instead > introduced a command line parameter to control it. The rationale > here being changing decay period of a PELT signal runtime can > result in a skewed average value for atleast some cycles. > > Documentation/admin-guide/kernel-parameters.txt | 5 +++++ > kernel/sched/thermal.c | 25 ++++++++++++++++++++++++- > 2 files changed, 29 insertions(+), 1 deletion(-) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index a84a83f..61d7baa 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -4273,6 +4273,11 @@ > incurs a small amount of overhead in the scheduler > but is useful for debugging and performance tuning. > > + sched_thermal_decay_coeff= > + [KNL, SMP] Set decay coefficient 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/thermal.c b/kernel/sched/thermal.c > index 0c84960..0da31e1 100644 > --- a/kernel/sched/thermal.c > +++ b/kernel/sched/thermal.c > @@ -10,6 +10,28 @@ > #include "pelt.h" > #include "thermal.h" > > +/** > + * By default the decay is the default pelt decay period. > + * The decay coefficient can change is decay period in > + * multiples of 32. This description has to be corrected as well, as per Peter's comment. Also, it might be good not to use the value 32 directly but to mention that the decay period is a shift of LOAD_AVG_PERIOD. If that changes, the translation from decay shift to decay period below will change as well. Thank you, Ionela. > + * Decay coefficient Decay period(ms) > + * 0 32 > + * 1 64 > + * 2 128 > + * 3 256 > + * 4 512 > + */ > +static int sched_thermal_decay_coeff; > + > +static int __init setup_sched_thermal_decay_coeff(char *str) > +{ > + if (kstrtoint(str, 0, &sched_thermal_decay_coeff)) > + pr_warn("Unable to set scheduler thermal pressure decay coefficient\n"); > + > + return 1; > +} > +__setup("sched_thermal_decay_coeff=", setup_sched_thermal_decay_coeff); > + > static DEFINE_PER_CPU(unsigned long, delta_capacity); > > /** > @@ -40,6 +62,7 @@ void update_thermal_pressure(int cpu, u64 capped_freq_ratio) > */ > void trigger_thermal_pressure_average(struct rq *rq) > { > - update_thermal_load_avg(rq_clock_task(rq), rq, > + update_thermal_load_avg(rq_clock_task(rq) >> > + sched_thermal_decay_coeff, rq, > per_cpu(delta_capacity, cpu_of(rq))); > } > -- > 2.1.4 >