In HCBS, the root control group follows the already existing rules for rt-task
scheduling. As such, it does not make use of the deadline servers to account for
runtime, or any other HCBS specific code and features.
While the runtime of SCHED_DEADLINE tasks depends on the global bandwidth
reserved for rt_tasks, the runtime of SCHED_FIFO/SCHED_RR tasks is limited by
the activation of fair-servers (as the RT_THROTTLING mechanism has been removed
in favour of them), thus their maximum bandwidth depends solely on the
fair-server settings (which are thightly related to the global bandwdith
reserved for rt-tasks) and the amount of SCHED_OTHER workload to run (recall
that if no SCHED_OTHER tasks are running, the FIFO/RR tasks may fully utilize
the CPU).
The values of runtime and period in the root cgroup's cpu controller do not
affect, by design of HCBS, the fair-server settings and similar (consequently
they do not affect the scheduling of FIFO/RR tasks in the root cgroup), buy they
are just used to reserve a portion of the SCHED_DEADLINE bandwidth to the
scheduling of rt-cgroups. These values only affect child cgroups, their deadline
servers and their assigned FIFO/RR tasks.
Signed-off-by: Yuri Andriaccio <yurand2000@gmail.com>
---
kernel/sched/rt.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 7c7622303e8..94693093b70 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2123,13 +2123,6 @@ static int tg_set_rt_bandwidth(struct task_group *tg,
static DEFINE_MUTEX(rt_constraints_mutex);
int i, err = 0;
- /*
- * Disallowing the root group RT runtime is BAD, it would disallow the
- * kernel creating (and or operating) RT threads.
- */
- if (tg == &root_task_group && rt_runtime == 0)
- return -EINVAL;
-
/* No period doesn't make any sense. */
if (rt_period == 0)
return -EINVAL;
@@ -2216,6 +2209,10 @@ static int sched_rt_global_constraints(void)
int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk)
{
+ /* Allow executing in the root cgroup regardless of allowed bandwidth */
+ if (tg == &root_task_group)
+ return 1;
+
/* Don't accept real-time tasks when there is no way for them to run */
if (rt_group_sched_enabled() && tg->dl_bandwidth.dl_runtime == 0)
return 0;
--
2.51.0