]> www.infradead.org Git - users/jedix/linux-maple.git/commit
sched/uclamp: Align uclamp and util_est and call before freq update
authorXuewen Yan <xuewen.yan@unisoc.com>
Thu, 17 Apr 2025 04:34:57 +0000 (12:34 +0800)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 21 May 2025 11:57:38 +0000 (13:57 +0200)
commit90ca9410dab21c407706726b86b6e50c6698b5af
treeee99accd92431e569d53c0b19eaf07ac0e4461c1
parent0212696a844631a923aa6cedd74ebbb3cf434e51
sched/uclamp: Align uclamp and util_est and call before freq update

The commit dfa0a574cbc47 ("sched/uclamg: Handle delayed dequeue")
has add the sched_delayed check to prevent double uclamp_dec/inc.
However, it put the uclamp_rq_inc() after enqueue_task().
This may lead to the following issues:
When a task with uclamp goes through enqueue_task() and could trigger
cpufreq update, its uclamp won't even be considered in the cpufreq
update. It is only after enqueue will the uclamp be added to rq
buckets, and cpufreq will only pick it up at the next update.
This could cause a delay in frequency updating. It may affect
the performance(uclamp_min > 0) or power(uclamp_max < 1024).

So, just like util_est, put the uclamp_rq_inc() before enqueue_task().
And as for the sched_delayed_task, same as util_est, using the
sched_delayed flag to prevent inc the sched_delayed_task's uclamp,
using the ENQUEUE_DELAYED flag to allow inc the sched_delayed_task's uclamp
which is being woken up.

Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Link: https://lore.kernel.org/r/20250417043457.10632-3-xuewen.yan@unisoc.com
kernel/sched/core.c