sched/fair: Refactor CPU utilization functions
authorDietmar Eggemann <dietmar.eggemann@arm.com>
Mon, 15 May 2023 11:57:34 +0000 (13:57 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 5 Jun 2023 19:13:43 +0000 (21:13 +0200)
commit3eb6d6ececca2fd566d717b37ab467c246f66be7
treeb546c0bf79b248cbdca1b2e613d36c112df77291
parente6a15fa9ea8372ad4db973191233f743ae1081d5
sched/fair: Refactor CPU utilization functions

There is a lot of code duplication in cpu_util_next() & cpu_util_cfs().

Remove this by allowing cpu_util_next() to be called with p = NULL.
Rename cpu_util_next() to cpu_util() since the '_next' suffix is no
longer necessary to distinct cpu utilization related functions.
Implement cpu_util_cfs(cpu) as cpu_util(cpu, p = NULL, -1).

This will allow to code future related cpu util changes only in one
place, namely in cpu_util().

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20230515115735.296329-2-dietmar.eggemann@arm.com
kernel/sched/fair.c
kernel/sched/sched.h