[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210201093412.4900-1-schwenderjonathan@gmail.com>
Date: Mon, 1 Feb 2021 10:34:12 +0100
From: Jonathan Schwender <schwenderjonathan@...il.com>
To: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org
Cc: dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, bristot@...hat.com, linux-kernel@...r.kernel.org,
linux-rt-users@...r.kernel.org
Subject: [RFC] sched/rt: Fix RT (group) throttling with nohz_full
If nohz_full is enabled (more precisely HK_FLAG_TIMER is set), then
do_sched_rt_period_timer may be called on a housekeeping CPU,
which would not service the isolated CPU for a non-root cgroup
(requires a kernel with RT_GROUP_SCHEDULING).
This causes RT tasks in a non-root cgroup to get throttled
indefinitely (unless throttling is disabled) once the timer has
been moved to a housekeeping CPU.
To fix this, housekeeping CPUs now service all online CPUs
if HK_FLAG_TIMER (nohz_full) is set.
I'm not really sure how this relates to Mike Galbraith previous
commit e221d028bb08 ("sched,rt: fix isolated CPUs leaving root_task_group
indefinitely throttled"), (which is dated before the housekeeping changes,)
so I'm posting this as an RFC.
Signed-off-by: Jonathan Schwender <schwenderjonathan@...il.com>
---
kernel/sched/rt.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 49ec096a8aa1..3185e00b828a 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -865,9 +865,16 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)
* isolation is really required, the user will turn the throttle
* off to kill the perturbations it causes anyway. Meanwhile,
* this maintains functionality for boot and/or troubleshooting.
+ * If nohz_full is active and the timer was offloaded to a
+ * housekeeping CPU, sched_rt_period_mask() will not contain
+ * the isolated CPU. To prevent indefinite throttling of tasks
+ * on isolated CPUs, housekeeping CPUs service all online CPUs.
*/
- if (rt_b == &root_task_group.rt_bandwidth)
+ if (rt_b == &root_task_group.rt_bandwidth
+ || (housekeeping_enabled(HK_FLAG_TIMER)
+ && housekeeping_cpu(this_rq()->cpu, HK_FLAG_TIMER))) {
span = cpu_online_mask;
+ }
#endif
for_each_cpu(i, span) {
int enqueue = 0;
--
2.29.2
Powered by blists - more mailing lists