diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 6ff09681e29b..89fc8c554702 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -25,6 +25,7 @@ struct sugov_tunables { unsigned int hispeed_freq; unsigned int rtg_boost_freq; bool pl; + bool iowait_boost_enable; }; struct sugov_policy { @@ -497,7 +498,10 @@ static bool sugov_iowait_reset(struct sugov_cpu *sg_cpu, u64 time, static void sugov_iowait_boost(struct sugov_cpu *sg_cpu, u64 time, unsigned int flags) { - bool set_iowait_boost = flags & SCHED_CPUFREQ_IOWAIT; + struct sugov_policy *sg_policy = sg_cpu->sg_policy; + bool set_iowait_boost = sg_policy->tunables->iowait_boost_enable ? + flags & SCHED_CPUFREQ_IOWAIT : + false; /* Reset boost if the CPU appears to have been idle enough */ if (sg_cpu->iowait_boost && @@ -1036,12 +1040,32 @@ static ssize_t pl_store(struct gov_attr_set *attr_set, const char *buf, 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 sprintf(buf, "%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 hispeed_load = __ATTR_RW(hispeed_load); static struct governor_attr hispeed_freq = __ATTR_RW(hispeed_freq); static struct governor_attr rtg_boost_freq = __ATTR_RW(rtg_boost_freq); static struct governor_attr pl = __ATTR_RW(pl); +static struct governor_attr iowait_boost_enable = __ATTR_RW(iowait_boost_enable); static struct attribute *sugov_attrs[] = { &up_rate_limit_us.attr, @@ -1050,6 +1074,7 @@ static struct attribute *sugov_attrs[] = { &hispeed_freq.attr, &rtg_boost_freq.attr, &pl.attr, + &iowait_boost_enable.attr, NULL }; ATTRIBUTE_GROUPS(sugov); @@ -1250,6 +1275,7 @@ static int sugov_init(struct cpufreq_policy *policy) tunables->down_rate_limit_us = cpufreq_policy_transition_delay_us(policy); tunables->hispeed_load = DEFAULT_HISPEED_LOAD; tunables->hispeed_freq = 0; + tunables->iowait_boost_enable = false; switch (policy->cpu) { default: