Skip to content

Commit

Permalink
kernel: sched: cpufreq_schedutil: Make iowait boost optional.
Browse files Browse the repository at this point in the history
Bug: 120438505
Change-Id: I59e3675a320ce71c3c90be3904756b125300ba6b
Signed-off-by: Miguel de Dios <migueldedios@google.com>
[dereference23: Forward port to 5.4]
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
  • Loading branch information
Miguel de Dios authored and ghazzor committed Sep 28, 2024
1 parent bbd73e1 commit 7aec595
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion kernel/sched/cpufreq_schedutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 &&
Expand Down Expand Up @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 7aec595

Please sign in to comment.