From 6b4eb857161e34fef98e01698bbeeaac5a1054a8 Mon Sep 17 00:00:00 2001 From: Miguel de Dios Date: Wed, 7 Nov 2018 16:56:18 -0800 Subject: [PATCH] kernel: sched: cpufreq_schedutil: Make iowait boost optional. Bug: 120438505 Change-Id: I59e3675a320ce71c3c90be3904756b125300ba6b Signed-off-by: Miguel de Dios Signed-off-by: Alexander Winkowski --- kernel/sched/cpufreq_schedutil.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 95be833281da..84869863e965 100755 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -25,6 +25,7 @@ struct sugov_tunables { struct gov_attr_set attr_set; unsigned int up_rate_limit_us; unsigned int down_rate_limit_us; + bool iowait_boost_enable; }; struct sugov_policy { @@ -238,6 +239,11 @@ static void sugov_get_util(unsigned long *util, unsigned long *max, int cpu) static void sugov_set_iowait_boost(struct sugov_cpu *sg_cpu, u64 time, unsigned int flags) { + struct sugov_policy *sg_policy = sg_cpu->sg_policy; + + if (!sg_policy->tunables->iowait_boost_enable) + return; + if (flags & SCHED_CPUFREQ_IOWAIT) { if (sg_cpu->iowait_boost_pending) return; @@ -534,12 +540,35 @@ static ssize_t down_rate_limit_us_store(struct gov_attr_set *attr_set, return count; } +static ssize_t iowait_boost_enable_show(struct gov_attr_set *attr_set, + char *buf) +{ + struct sugov_tunables *tunables = to_sugov_tunables(attr_set); + return snprintf(buf, PAGE_SIZE, "%u\n", + tunables->iowait_boost_enable); +} + +static ssize_t iowait_boost_enable_store(struct gov_attr_set *attr_set, + const char *buf, size_t count) +{ + struct sugov_tunables *tunables = to_sugov_tunables(attr_set); + bool enable; + if (kstrtobool(buf, &enable)) + return -EINVAL; + + tunables->iowait_boost_enable = enable; + return count; +} + static struct governor_attr up_rate_limit_us = __ATTR_RW(up_rate_limit_us); static struct governor_attr down_rate_limit_us = __ATTR_RW(down_rate_limit_us); +static struct governor_attr iowait_boost_enable = + __ATTR_RW(iowait_boost_enable); static struct attribute *sugov_attributes[] = { &up_rate_limit_us.attr, &down_rate_limit_us.attr, + &iowait_boost_enable.attr, NULL }; @@ -726,6 +755,7 @@ static int sugov_init(struct cpufreq_policy *policy) cpufreq_policy_transition_delay_us(policy); tunables->down_rate_limit_us = cpufreq_policy_transition_delay_us(policy); + tunables->iowait_boost_enable = false; policy->governor_data = sg_policy; sg_policy->tunables = tunables;