[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1457932932-28444-5-git-send-email-mturquette+renesas@baylibre.com>
Date: Sun, 13 Mar 2016 22:22:08 -0700
From: Michael Turquette <mturquette@...libre.com>
To: peterz@...radead.org, rjw@...ysocki.net
Cc: linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
Juri.Lelli@....com, steve.muckle@...aro.org,
morten.rasmussen@....com, dietmar.eggemann@....com,
vincent.guittot@...aro.org,
Michael Turquette <mturquette+renesas@...libre.com>
Subject: [PATCH 4/8] cpufreq/schedutil: sysfs capacity margin tunable
With the addition of the global cfs capacity margin helpers in patch,
"sched/cpufreq: new cfs capacity margin helpers", we can now export
sysfs tunables from the schedutil governor. This allows privileged users
to tune the value more easily.
The margin value is global to cfs, not per-policy. As such schedutil
does not store any state about the margin. Schedutil restores the margin
value to its default value when exiting.
Signed-off-by: Michael Turquette <mturquette+renesas@...libre.com>
---
drivers/cpufreq/cpufreq_schedutil.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/cpufreq/cpufreq_schedutil.c b/drivers/cpufreq/cpufreq_schedutil.c
index 5aa26bf..12e49b9 100644
--- a/drivers/cpufreq/cpufreq_schedutil.c
+++ b/drivers/cpufreq/cpufreq_schedutil.c
@@ -246,8 +246,32 @@ static ssize_t rate_limit_us_store(struct gov_attr_set *attr_set, const char *bu
static struct governor_attr rate_limit_us = __ATTR_RW(rate_limit_us);
+static ssize_t capacity_margin_show(struct gov_attr_set *not_used,
+ char *buf)
+{
+ return sprintf(buf, "%lu\n", cpufreq_get_cfs_capacity_margin());
+}
+
+static ssize_t capacity_margin_store(struct gov_attr_set *attr_set,
+ const char *buf, size_t count)
+{
+ unsigned long margin;
+ int ret;
+
+ ret = sscanf(buf, "%lu", &margin);
+ if (ret != 1)
+ return -EINVAL;
+
+ cpufreq_set_cfs_capacity_margin(margin);
+
+ return count;
+}
+
+static struct governor_attr capacity_margin = __ATTR_RW(capacity_margin);
+
static struct attribute *sugov_attributes[] = {
&rate_limit_us.attr,
+ &capacity_margin.attr,
NULL
};
@@ -381,6 +405,7 @@ static int sugov_exit(struct cpufreq_policy *policy)
mutex_lock(&global_tunables_lock);
+ cpufreq_reset_cfs_capacity_margin();
count = gov_attr_set_put(&tunables->attr_set, &sg_policy->tunables_hook);
policy->governor_data = NULL;
if (!count)
--
2.1.4
Powered by blists - more mailing lists