Hi Joel,
On Tue, Oct 24, 2017 at 07:37:41AM -0700, Joel Fernandes wrote:
Hi Leo,
On Mon, Oct 23, 2017 at 11:21 PM, Leo Yan leo.yan@linaro.org wrote:
CPU utilization is not only about CFS utilization, it also includes RT/DL utilization. Current code we track utilization with both PELT and WALT signals.
For PELT signal: CFS has its own utilization tracking, and has another signal which uses PELT algorithm to track RT/DL utilization value;
For WALT signal: WALT signal has accumulated all scheduling class utilization into single one signal, so directly use the value return back from cpu_util().
This commit provides the two functions to calculate the CPU summed utilization, the function cpu_util_sum() returns the summed utilization for specified CPU; the function __cpu_util_sum() needs to pass the CFS and RT utilization value and return back summed value, so this function can be used for some estimation case, e.g. we can pass the estimated CFS utilization if place one waken task on the specified CPU.
Signed-off-by: Leo Yan leo.yan@linaro.org
kernel/sched/sched.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index d01a06f..1928d27 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1822,6 +1822,35 @@ static inline unsigned long cpu_util_est(int cpu) }
unsigned long boosted_cpu_util(int cpu);
+/**
- __cpu_util_sum: get summed utilization for the specified CPU
- @cpu: the CPU to get the summed utilization for
- According to the passed parameter for RT utilization and CFS
- utilization to calculate the sum utilization for the CPU. The WALT
- signal has includes CFS/RT/DL classes utilization, so directly
- return back the utilization value; PELT signal will accumulate RT/DL
- and CFS utilization.
- Return: the summed utilization for the specified CPU
- */
+static inline unsigned long __cpu_util_sum(int cpu, unsigned long rt_util,
unsigned long cfs_util)
+{ +#ifdef CONFIG_SCHED_WALT
if (!walt_disabled && sysctl_sched_use_walt_cpu_util)
return cfs_util;
+#endif
return (rt_util + cfs_util);
Just thinking out loud - would it be better to simply make: rt_util = (capacity_orig_of - capacity_of) as the RT pressure utilization? This will also consider IRQ pressure and is a bit more generic. Also maybe have a helper function to calculate the RT utilization?
Be honest, before I worked out this patch set I took advice with Vincent; and I tried to use capacity_of() to present the RT pressure.
But finally I work out this patch with below reasons:
Firstly capacity_of() doesn't update RT pressure utilization when everytime call it; the RT pressure utilization is updated periodically in load balance. So we need firstly resolve the question for updating RT pressure utilization for capacity_of() for every call and without introducing big workload.
If using (capacity_orig_of - capcity_of) to repsent RT utilization, I have one more question is: why not directly use rt_avg or rt.avg.util_sum (PELT for RT class)?
Thanks, Leo Yan