Skip to content
Commit b9dec4e1 authored by Patrick Bellasi's avatar Patrick Bellasi Committed by Douglas Raillard
Browse files

sched/core: uclamp: Extend sched_setattr() to support utilization clamping



The SCHED_DEADLINE scheduling class provides an advanced and formal
model to define tasks requirements that can translate into proper
decisions for both task placements and frequencies selections. Other
classes have a more simplified model based on the POSIX concept of
priorities.

Such a simple priority based model however does not allow to exploit
most advanced features of the Linux scheduler like, for example, driving
frequencies selection via the schedutil cpufreq governor. However, also
for non SCHED_DEADLINE tasks, it's still interesting to define tasks
properties to support scheduler decisions.

Utilization clamping exposes to user-space a new set of per-task
attributes the scheduler can use as hints about the expected/required
utilization for a task. This allows to implement a "proactive" per-task
frequency control policy, a more advanced policy than the current one
based just on "passive" measured task utilization. For example, it's
possible to boost interactive tasks (e.g. to get better performance) or
cap background tasks (e.g. to be more energy/thermal efficient).

Introduce a new API to set utilization clamping values for a specified
task by extending sched_setattr(), a syscall which already allows to
define task specific properties for different scheduling classes. A new
pair of attributes allows to specify a minimum and maximum utilization
the scheduler can consider for a task.

Do that by checking and validating the required clamp values before and
then applying the required changes using _the_ same pattern already in
use for __setscheduler(). This ensures that the task is re-enqueued with
the new clamp values.

Do not allow to change sched class specific params and non class
specific params (i.e. clamp values) at the same time.  This keeps things
simple and still works for the most common cases since we are usually
interested in just one of the two actions.

Signed-off-by: default avatarPatrick Bellasi <patrick.bellasi@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>

---
Changes in v7:
 Message-ID: <20190124123814.GM13777@hirez.programming.kicks-ass.net>
 - split validation code from actual state changing code
 - for state changing code, use _the_ same pattern __setscheduler() and
   other code already use, i.e. dequeue-change-enqueue
 - add SCHED_FLAG_KEEP_PARAMS and use it to skip __setscheduler() when
   policy and params are not specified
parent bf7b4cf0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment