lkml.org 
[lkml]   [2020]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] thermal: cpufreq_cooling: Reuse effective_cpu_util()
On Tuesday 14 Jul 2020 at 12:06:53 (+0530), Viresh Kumar wrote:
> /**
> - * get_load() - get load for a cpu since last updated
> + * get_load() - get current load for a cpu
> * @cpufreq_cdev: &struct cpufreq_cooling_device for this cpu
> * @cpu: cpu number
> - * @cpu_idx: index of the cpu in time_in_idle*
> + * @cpu_idx: index of the cpu
> *
> - * Return: The average load of cpu @cpu in percentage since this
> - * function was last called.
> + * Return: The current load of cpu @cpu in percentage.
> */
> static u32 get_load(struct cpufreq_cooling_device *cpufreq_cdev, int cpu,
> int cpu_idx)
> {
> - u32 load;
> - u64 now, now_idle, delta_time, delta_idle;
> - struct time_in_idle *idle_time = &cpufreq_cdev->idle_time[cpu_idx];
> -
> - now_idle = get_cpu_idle_time(cpu, &now, 0);
> - delta_idle = now_idle - idle_time->time;
> - delta_time = now - idle_time->timestamp;
> + unsigned long util = cpu_util_cfs(cpu_rq(cpu));
> + unsigned long max = arch_scale_cpu_capacity(cpu);

Should we subtract the thermal PELT signal from max? I'm worried that
if we don't do that, the load computed in this function will look
artificially small when IPA is capping the max freq, and that we'll
enter a weird oscillating state due to the cyclic dependency here.

Thoughts?

>
> - if (delta_time <= delta_idle)
> - load = 0;
> - else
> - load = div64_u64(100 * (delta_time - delta_idle), delta_time);
> -
> - idle_time->time = now_idle;
> - idle_time->timestamp = now;
> -
> - return load;
> + util = effective_cpu_util(cpu, util, max, ENERGY_UTIL, NULL);
> + return (util * 100) / max;
> }


Thanks,
Quentin

\
 
 \ /
  Last update: 2020-07-17 12:15    [W:0.160 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site