Skip to content

RFC Use EDF to throttle RT task groups

Fabio Checconi lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest8 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8Fix rt_rq->pushable_tasks initialization in init_rt_rq()kernel/sched.c+1 -12 replies
2/8Fix hrtick handlingkernel/sched.c+17 -31 reply
3/8Replace struct prio_array with an RB treeinclude/linux/init_task.h include/linux/sched.h kernel/sched.c +1 more+117 -680 replies
4/8Remove the balancing logickernel/sched_rt.c+0 -1420 replies
5/8Use EDF to throttle RT tasks hierarchicallykernel/sched.c kernel/sched_debug.c kernel/sched_rt.c+559 -2410 replies
6/8Modify the curr/next priority trackingkernel/sched_rt.c+63 -190 replies
7/8Reprogram timers only when necessarykernel/sched_rt.c+18 -10 replies
8/8Use hrtick when availablekernel/sched_rt.c+31 -10 replies

Reviews trailers per patch

None of the 8 patches has a Reviewed-by or Acked-by.

PatchPeter Zijlstra
1/8
2/8Not-Signed-off-by
3/8
4/8
5/8
6/8
7/8
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC][PATCH 0/8] Use EDF to throttle RT task groups

This patchset introduces a group level EDF scheduler to extend the current throttling mechanism, in order to make it support generic period assignments. With this patch, the rt_runtime and rt_period parameters can be used to specify arbitrary CPU reservations for RT tasks.

The first two patches fix two problems of the current implementation.

This is an early RFC, I'm interested in having an idea of what people think about this feature, if it's worth working on it, what can be improved in the design, etc.

The main design issues involved:

- It is no more possible to specify RUNTIME_INF for a task group when throttling is enabled. Rationale: supporting both throttled and unthrottled groups would have required too much extra complexity (I didn't find anything simpler than two parallel runqueues, one for throttled and one for unthrottled groups).

- Since it is not easy to mix tasks and groups on the same scheduler queue (tasks have no deadlines), the bandwidth reserved to the tasks in a group is controlled with two additional cgroup attributes:
rt_task_runtime_us and rt_task_period_us. These attrinutes control, within a cgroup, how much bandwidth is reserved to the tasks it contains.

- Shared resources are still handled using boosting. When a group contains a task inside a critical section it is scheduled according the highest priority among the ones of the tasks it contains. In this way, the same group has two modes: when it is not boosted it is scheduled according to its deadline; when it is boosted, it is scheduled according its priority. Boosted groups are always favored over non-boosted ones.

- The old priority array is now gone. To use only a single data structure for entities using both priorities and deadlines (due to boosting), the only possible choice was to use an rb-tree; the function used to order the keys takes into account the prioritization described above (boosted tasks, ordered by priority are favored to non-boosted tasks, ordered by increasing deadline).

- Given that the various rt_rq's belonging to the same task group are activated independently, there is the need of a timer per each rt_rq.

The patchset is against sched-devel, and (temporarily) depends on CONFIG_RT_GROUP_SCHED.

Any kind of feedback is welcome.

Fabio Checconi (8):
Fix rt_rq->pushable_tasks initialization in init_rt_rq() Fix hrtick handling
Replace struct prio_array with an RB tree Remove the balancing logic
Use EDF to throttle RT tasks hierarchically Modify the curr/next priority tracking Reprogram timers only when necessary
Use hrtick when available

 include/linux/init_task.h |    1 -
 include/linux/sched.h     |    2 +-
 kernel/sched.c            |  553 +++++++++++++++++++++++++------------
 kernel/sched_debug.c      |    4 +-
 kernel/sched_rt.c         |  672 +++++++++++++++++++++++++++------------------
 5 files changed, 781 insertions(+), 451 deletions(-)