Skip to content

Commit

Permalink
sched/alt: Fix limited cpufreq for schedutil.
Browse files Browse the repository at this point in the history
Here is the first fix for ChimeraOS#12, which fix the limited cpufreq for
schedutil. But it still tend to stay at max cpufreq.
  • Loading branch information
cchalpha committed Nov 18, 2024
1 parent ffb5899 commit ae4b838
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion kernel/sched/alt_sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,8 @@ static inline void cpufreq_update_util(struct rq *rq, unsigned int flags)
{
struct update_util_data *data;

data = rcu_dereference_sched(*this_cpu_ptr(&cpufreq_update_util_data));
data = rcu_dereference_sched(*per_cpu_ptr(&cpufreq_update_util_data,
cpu_of(rq)));
if (data)
data->func(data, rq_clock(rq), flags);
}
Expand Down
13 changes: 9 additions & 4 deletions kernel/sched/cpufreq_schedutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,16 @@ static void sugov_get_util(struct sugov_cpu *sg_cpu, unsigned long boost)
sg_cpu->bw_min = min;
sg_cpu->util = sugov_effective_cpu_perf(sg_cpu->cpu, util, min, max);
}

#else /* CONFIG_SCHED_ALT */
static unsigned long sugov_get_util(struct sugov_cpu *sg_cpu)

static void sugov_get_util(struct sugov_cpu *sg_cpu)
{
sg_cpu->max = arch_scale_cpu_capacity(sg_cpu->cpu);
return sg_cpu->max;
unsigned long max = arch_scale_cpu_capacity(sg_cpu->cpu);

sg_cpu->max = max;
sg_cpu->bw_dl = 0;
sg_cpu->util = cpu_rq(sg_cpu->cpu)->nr_running ? max:0UL;
}
#endif

Expand Down Expand Up @@ -374,8 +379,8 @@ static inline void ignore_dl_rate_limit(struct sugov_cpu *sg_cpu)
{
#ifndef CONFIG_SCHED_ALT
if (cpu_bw_dl(cpu_rq(sg_cpu->cpu)) > sg_cpu->bw_min)
#endif
sg_cpu->sg_policy->limits_changed = true;
#endif
}

static inline bool sugov_update_single_common(struct sugov_cpu *sg_cpu,
Expand Down

0 comments on commit ae4b838

Please sign in to comment.