Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2045874ybl; Sat, 11 Jan 2020 08:00:33 -0800 (PST) X-Google-Smtp-Source: APXvYqxlatIfifPZUoUmA5640CN91KL2eGgRLOUoaaYF6zrEpX/ilfq3jMbvlIVYxVtezM7Uy9AC X-Received: by 2002:aca:530e:: with SMTP id h14mr6527024oib.105.1578758433618; Sat, 11 Jan 2020 08:00:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578758433; cv=none; d=google.com; s=arc-20160816; b=THbgd8eMoAEfeSkA69a+8Xc62oYO4a/YXuqqaYmY238qGd7c+M8SWWGSjPM4B7BpNA Bf//LrY3gIUX6yFEgLbns4S/bepHzat10aYR18Dta9YFcMApdeNZuA56lrQUYkUQY06z sTpOnXz74paKT8woblI/X+p6aaMWsOqunHgkvrW+irl7wPILrO5z57QeTaanb6Kndzxm ql+wQz4j/+3y9VI/GEKz9QIinBnsELheSOjxrrSez9005RB9r6o/nT4otumM+Q8ZMyhO HZ+0XJ3RAN6Hl1JV4oPzbQ80wagt0F0Vn35BaSJE2S3emrWVOeHXmtGfjGg5psmWYKWQ 1sXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=yfen/AoSu53olPP9ksuFCbFgbf4x6IRveD5uzGZKIms=; b=NW/RvOjHqGkHSy8gWQFm9w78++qJoRpqUEgaS1dkgnS77XmitUbzEDE5LbUWiTEBTG +4dGPRHSNJ6x0KvAg/WDjtLnR2Zm74rHayqfCij8c7mMxppRRt/PPqtlZB7xDm6trPJu smQhCReMCrrFhlyX3175FhMA8br5UUKoiK3sGQJT6pXT9k7YSY+fmrCtOFs0W0aLds+L jMBzmiqmwnwBRInrDYIP2Fv8yUXHZpneITWfxuzvh6N1EZ3R2xiYgGLNhzt8Yec3HdCR A5vZnY3N6ZNzQSe0Y7JFfRJDDG9Q8oivaQz/bplOUFwWhBgrUowWBRBpbUdKW4ycvDBa GM6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bhytG7Z4; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q17si5025282otr.219.2020.01.11.08.00.22; Sat, 11 Jan 2020 08:00:33 -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=@linaro.org header.s=google header.b=bhytG7Z4; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730371AbgAKP7V (ORCPT + 99 others); Sat, 11 Jan 2020 10:59:21 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:46286 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730290AbgAKP7T (ORCPT ); Sat, 11 Jan 2020 10:59:19 -0500 Received: by mail-qk1-f195.google.com with SMTP id r14so4753017qke.13 for ; Sat, 11 Jan 2020 07:59:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yfen/AoSu53olPP9ksuFCbFgbf4x6IRveD5uzGZKIms=; b=bhytG7Z4CwxXRSJ9vrxvQYrzDIdOk+2i5GNnEXLk6aMfWdM3QxOL6mpX/adL6X3iHv wFRR6oNYVyJlpTjUDhjKM7ru98VDP5n9iuwFmT2qsjTlq8kUL5MHtrrlgBQqDAPaVNnA lV3Hioi7wKvgJHY9hLRM0dazA75aXcYcspPrA14KCAX2G3KrIJ37dxGVb+Z5ntENdklL N+uB+KYKUVSJNClhdcGN7ZxiqUorV7YDpWZ8O6RpALH6ZQVuqbze6O5gukSySh3Hs4HH XF6vKhXSrbYyGS3ISjVKkyW/k54VVDMOZWJIskKPgnmg4N+AUq8XCNhzdAo3slKYAX3Y txDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yfen/AoSu53olPP9ksuFCbFgbf4x6IRveD5uzGZKIms=; b=J3KsiSbbH3wbWmTg9+vNHCV9em1AC2o8CyKlNBBlTCBoBZFBmPHSZWQpmFrg45ITQp Z0oPP9y+lsQnm6vTUUCUcQ41Yonn7CQLVsVnBBd7bqVRbmKt9/LTtKaJgRNcZY8Tnjp4 vXimCjBDPf0cmfF37PksPNcYbfaQ7ekNLlMnvLUlV4DhPYFPBZVSmSYH22p79AaUlWOl GEXDTbRMoA0mv1icn31Gd0raoJjK1b7pxcVtqMQ1uCRnlwPD4ThrVfTt6jPLu3Tmq6ND tdlo520S+1S32m/h0Y8cjeV+2vLqrarxCdxRxuvTbfuYX7anVaTavECYWpLa8GptqqYT S9ag== X-Gm-Message-State: APjAAAXCZBHUYerZ7aJvIRxZ0K/POUQTjETO3ACMp3OIA5k7+mF5nCy/ ggm57vs7ngzESX9sOB3utGTVCg== X-Received: by 2002:a05:620a:910:: with SMTP id v16mr8621170qkv.194.1578758358708; Sat, 11 Jan 2020 07:59:18 -0800 (PST) Received: from Thara-Work-Ubuntu.fios-router.home (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.googlemail.com with ESMTPSA id l49sm2843478qtk.7.2020.01.11.07.59.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 11 Jan 2020 07:59:18 -0800 (PST) From: Thara Gopinath To: mingo@redhat.com, peterz@infradead.org, ionela.voinescu@arm.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rui.zhang@intel.com, qperret@google.com, daniel.lezcano@linaro.org, viresh.kumar@linaro.org Cc: linux-kernel@vger.kernel.org, amit.kachhap@gmail.com, javi.merino@kernel.org, amit.kucheria@verdurent.com Subject: [Patch v7 7/7] sched/fair: Enable tuning of decay period Date: Sat, 11 Jan 2020 10:59:06 -0500 Message-Id: <1578758346-507-8-git-send-email-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1578758346-507-1-git-send-email-thara.gopinath@linaro.org> References: <1578758346-507-1-git-send-email-thara.gopinath@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thermal pressure follows pelt signals which means the decay period for thermal pressure is the default pelt decay period. Depending on soc characteristics 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 --- Documentation/admin-guide/kernel-parameters.txt | 5 ++++ kernel/sched/fair.c | 34 +++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index dd3df3d..34848e4 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -4370,6 +4370,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 between 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 2b1fec3..8b2ee5a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -86,6 +86,36 @@ static unsigned int normalized_sysctl_sched_wakeup_granularity = 1000000UL; const_debug unsigned int sysctl_sched_migration_cost = 500000UL; +/** + * 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 inline u64 rq_clock_thermal(struct rq *rq) +{ + return rq_clock_task(rq) >> sched_thermal_decay_shift; +} + +static int __init setup_sched_thermal_decay_shift(char *str) +{ + int _shift; + + if (kstrtoint(str, 0, &_shift)) + pr_warn("Unable to set scheduler thermal pressure decay shift parameter\n"); + + sched_thermal_decay_shift = clamp(_shift, 0, 10); + return 1; +} +__setup("sched_thermal_decay_shift=", setup_sched_thermal_decay_shift); + #ifdef CONFIG_SMP /* * For asym packing, by default the lower numbered CPU has higher priority. @@ -7509,7 +7539,7 @@ static bool __update_blocked_others(struct rq *rq, bool *done) decayed = update_rt_rq_load_avg(now, rq, curr_class == &rt_sched_class) | update_dl_rq_load_avg(now, rq, curr_class == &dl_sched_class) | - update_thermal_load_avg(rq_clock_task(rq), rq, + update_thermal_load_avg(rq_clock_thermal(rq), rq, thermal_pressure) | update_irq_load_avg(rq, 0); @@ -10300,7 +10330,7 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued) update_misfit_status(curr, rq); update_overutilized_status(task_rq(curr)); - update_thermal_load_avg(rq_clock_task(rq), rq, thermal_pressure); + update_thermal_load_avg(rq_clock_thermal(rq), rq, thermal_pressure); } /* -- 2.1.4