From patchwork Mon Oct 14 00:58:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 176108 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3886756ill; Sun, 13 Oct 2019 17:58:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2Lhpw9Mu6vsI6nTcX8yBWHkFPL5Zz0guLy9bDc+XMS9W6dKD8i2DAgURedVs1271xIy2d X-Received: by 2002:aa7:ce08:: with SMTP id d8mr26488481edv.260.1571014726436; Sun, 13 Oct 2019 17:58:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571014726; cv=none; d=google.com; s=arc-20160816; b=nztTN9RDM4tNy/OOqC3jojfKxLkrjaLc+xmC6xyWmevv8UfovereXCOYFAL0tue6Tc iYjQxMTItletZ7RU8vOjLd3vtQLRL1qjj9cK3p/s3WAhsiEwh7geLujTOSIUXKAsVMnf SrOguglXahD0kUu6TCQGe0hkIvmmbW0HlWlpM2UPHtj8NA03++OqmuqRH7pLKdmTIDEw oGwpVBCezI2o0A4Eyar8yq4sWPqpSCNoEpZOi6zbnT48GPVDEafRDm7QINndRrV4TO2Q TEFvjHe8aRoa4+NdvMXPpcS/cX2dX5EH3f8w1CGqAriiIJAPpWyK93ZyaVrhk7IRbhTp 6NSw== 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=aPyEagV1DxsvKL/RZo3njz7RJXo5X1hyEh5ILDelpv8=; b=m+DqVo9M2mSAt0mcDFDaul6GKpsOmxCYw6Qd1aZcVrf5138/8WOXW/Li+vYq0O0O0N 8ydrrYNLSaeUBFK2Ks24q3+EmD5W9KuJMMzUy3bk+bKyifD0cy+pKxQ8RirSfXQrUbKu xMQA7TLYPAXv3HXf4vFmjmZybII8WnFS9Ij1q4HKZL8lMtsVhOQLjfPHoGCpm6Z/FQJj CYM2mgmC6L0nHDwgEeODlpxtkwX4UbYEuG724UBjuA5dUVC8q3KOJVcLOcZjkw/S0pGv kUP3TlGDeJDYwiU+LkUOdOrCzMslfKpUzvO7g9w2alOIBBVFL4gefthm6fJ73jk2l/QK J0wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JEUmMaVv; 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 k63si11552891edc.347.2019.10.13.17.58.46; Sun, 13 Oct 2019 17:58:46 -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=@linaro.org header.s=google header.b=JEUmMaVv; 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 S1729796AbfJNA6j (ORCPT + 10 others); Sun, 13 Oct 2019 20:58:39 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:36721 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729755AbfJNA6h (ORCPT ); Sun, 13 Oct 2019 20:58:37 -0400 Received: by mail-qt1-f196.google.com with SMTP id o12so23149369qtf.3 for ; Sun, 13 Oct 2019 17:58:37 -0700 (PDT) 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=aPyEagV1DxsvKL/RZo3njz7RJXo5X1hyEh5ILDelpv8=; b=JEUmMaVvI1LTbq3LGF/EHz2CBzkv+GbwvnLMnASrc+hIV9wAca7MyTEh6eTobXhfHE Q+Ca96u2yVxistrNN4nSIttKWMZAiGhjYxHE77kJtMg0Fq3B7kgItwp0zzgctcRMzCIQ pTxOgNH2GVIWWo/X+ghPkmT6MPxxVvXV+Pa7tFIpr6H+oVMT4+oKmwkodX63ZPfQ9naB bWXkxqp6QL3TBDPXGj5sXeGa0xGNkuN4ZaIQqDLYHK1vx2zyXzfRCheESeEG2c9ANJW3 rDLndBM3+sVJpeXsvRP4XoSU/uhEUqmQ09mzeqwPJZhfuuWnKWQ2vg/YvS2eXhUM/KG1 +IJA== 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=aPyEagV1DxsvKL/RZo3njz7RJXo5X1hyEh5ILDelpv8=; b=rw/mEP63PmdmRUJCUzs/hp3EwV5HfGaE93SwMxKNlwM7UukCiu/Q5KODFzw4o1ZfdJ dYrMsjhV2AU/CI6USuO3gVgQGS78xSw93SDDAbf7YOT80d1b+Y5mAuay9r2Jklf5Oarx AOC7QsZXgmmWibB4nRwNrZU7ptJXUzncEnbfzoRGIQOYnrt124GDOgVPsLbETQ79TV+0 qL3ytuC9yzRxdzmIlIIt+5Jrks1dsL3aOq+glInTTpoJtid1pnZqZk0rxWI3LO15dUr1 cXjmxcPCmRvXt2TUzU/SKIgfP6E1VBC3UXZIIhcjjP7U9Kqx6Lz0w/0FconJMdtE1LyG m4Pg== X-Gm-Message-State: APjAAAWumtn+klowBlkM61lkZSNZPHVMBqiDzSQtl+rSFZT4YSjUTZnD LpDw/OrHEnX38ng3bzt9YIsSkg== X-Received: by 2002:ac8:363c:: with SMTP id m57mr30156349qtb.290.1571014716532; Sun, 13 Oct 2019 17:58:36 -0700 (PDT) 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 c185sm7663901qkf.122.2019.10.13.17.58.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 13 Oct 2019 17:58:35 -0700 (PDT) From: Thara Gopinath To: mingo@redhat.com, peterz@infradead.org, ionela.voinescu@arm.com, vincent.guittot@linaro.org, rui.zhang@intel.com, edubezval@gmail.com Cc: linux-kernel@vger.kernel.org, amit.kachhap@gmail.com, javi.merino@kernel.org, daniel.lezcano@linaro.org Subject: [Patch v3 7/7] sched: thermal: Enable tuning of decay period Date: Sun, 13 Oct 2019 20:58:25 -0400 Message-Id: <1571014705-19646-8-git-send-email-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1571014705-19646-1-git-send-email-thara.gopinath@linaro.org> References: <1571014705-19646-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 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 slow decay is to right shift the now run time. Signed-off-by: Thara Gopinath --- include/linux/sched/sysctl.h | 1 + kernel/sched/thermal.c | 16 +++++++++++++++- kernel/sysctl.c | 7 +++++++ 3 files changed, 23 insertions(+), 1 deletion(-) -- 2.1.4 diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index d4f6215..f4c4afd 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h @@ -41,6 +41,7 @@ extern unsigned int sysctl_numa_balancing_scan_size; #ifdef CONFIG_SCHED_DEBUG extern __read_mostly unsigned int sysctl_sched_migration_cost; extern __read_mostly unsigned int sysctl_sched_nr_migrate; +extern __read_mostly unsigned int sysctl_sched_thermal_decay_coeff; int sched_proc_update_handler(struct ctl_table *table, int write, void __user *buffer, size_t *length, diff --git a/kernel/sched/thermal.c b/kernel/sched/thermal.c index 5f0b2d4..2a00488 100644 --- a/kernel/sched/thermal.c +++ b/kernel/sched/thermal.c @@ -10,6 +10,19 @@ #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. + * Decay coefficient Decay period(ms) + * 0 32 + * 1 64 + * 2 128 + * 3 256 + * 4 512 + */ +unsigned int sysctl_sched_thermal_decay_coeff __read_mostly; + struct max_capacity_info { unsigned long max_capacity; unsigned long cap_capacity; @@ -62,5 +75,6 @@ void update_periodic_maxcap(struct rq *rq) return; delta = __max_cap->max_capacity - __max_cap->cap_capacity; - update_thermal_avg(rq_clock_task(rq), rq, delta); + update_thermal_avg((rq_clock_task(rq) >> + sysctl_sched_thermal_decay_coeff), rq, delta); } diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 00fcea2..5056c08 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -376,6 +376,13 @@ static struct ctl_table kern_table[] = { .mode = 0644, .proc_handler = proc_dointvec, }, + { + .procname = "sched_thermal_decay_coeff", + .data = &sysctl_sched_thermal_decay_coeff, + .maxlen = sizeof(unsigned int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, #ifdef CONFIG_SCHEDSTATS { .procname = "sched_schedstats",