History

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().

Dietmar Eggemann committed 6 years ago

Commit 480a6ca1 parent b19a8882 files · +53 −19Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/sched/types.h+2−0
@@ -96,6 +96,8 @@ struct sched_param { · 95 unmodified lines
96 * on a CPU with a capacity big enough to fit the specified value.96 * on a CPU with a capacity big enough to fit the specified value.
97 * A task with a max utilization value smaller than 1024 is more likely97 * A task with a max utilization value smaller than 1024 is more likely
98 * scheduled on a CPU with no more capacity than the specified value.98 * scheduled on a CPU with no more capacity than the specified value.
99 *
100 * A task utilization boundary can be reset by setting the attribute to -1.
99 */101 */
100struct sched_attr {102struct sched_attr {
101 __u32 size;103 __u32 size;