]> git.baikalelectronics.ru Git - kernel.git/commit
sched/uclamp: Allow to reset a task uclamp constraint value
authorDietmar Eggemann <dietmar.eggemann@arm.com>
Fri, 13 Nov 2020 11:34:54 +0000 (12:34 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 19 Nov 2020 10:25:47 +0000 (11:25 +0100)
commitb4d197b9769b333f5d1b58a2d9f05c49e7e86a9f
treeb8aeff5c9857ad96c731c1d7b268aa408bdbcee6
parentff28a36ea990d5359b1c29dffdaaf87644c76775
sched/uclamp: Allow to reset a task uclamp constraint value

In case the user wants to stop controlling a uclamp constraint value
for a task, use the magic value -1 in sched_util_{min,max} with the
appropriate sched_flags (SCHED_FLAG_UTIL_CLAMP_{MIN,MAX}) to indicate
the reset.

The advantage over the 'additional flag' approach (i.e. introducing
SCHED_FLAG_UTIL_CLAMP_RESET) is that no additional flag has to be
exported via uapi. This avoids the need to document how this new flag
has be used in conjunction with the existing uclamp related flags.

The following subtle issue is fixed as well. When a uclamp constraint
value is set on a !user_defined uclamp_se it is currently first reset
and then set.
Fix this by AND'ing !user_defined with !SCHED_FLAG_UTIL_CLAMP which
stands for the 'sched class change' case.
The related condition 'if (uc_se->user_defined)' moved from
__setscheduler_uclamp() into uclamp_reset().

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Yun Hsiang <hsiang023167@gmail.com>
Link: https://lkml.kernel.org/r/20201113113454.25868-1-dietmar.eggemann@arm.com
include/uapi/linux/sched/types.h
kernel/sched/core.c