* [RFC] sched/rt: Fix RT (group) throttling with nohz_full
@ 2021-02-01 9:34 Jonathan Schwender
2021-02-02 9:00 ` [RFC v2] " Jonathan Schwender
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Schwender @ 2021-02-01 9:34 UTC (permalink / raw)
To: mingo, peterz, juri.lelli, vincent.guittot
Cc: dietmar.eggemann, rostedt, bsegall, mgorman, bristot,
linux-kernel, linux-rt-users
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@gmail.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [RFC v2] sched/rt: Fix RT (group) throttling with nohz_full
2021-02-01 9:34 [RFC] sched/rt: Fix RT (group) throttling with nohz_full Jonathan Schwender
@ 2021-02-02 9:00 ` Jonathan Schwender
2021-02-22 13:44 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Schwender @ 2021-02-02 9:00 UTC (permalink / raw)
To: mingo, peterz, juri.lelli, vincent.guittot
Cc: dietmar.eggemann, rostedt, bsegall, mgorman, bristot,
linux-kernel, linux-rt-users, kernel test robot
RFC v2 changes: Fix compile error if CONFIG_SMP is not set, which was
Reported-by: kernel test robot <lkp@intel.com>
I'm now using smp_processor_id() to get the ID of the CPU the timer
is running on.
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@gmail.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 8f720b71d13d..879abb5de023 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -866,9 +866,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(smp_processor_id(), HK_FLAG_TIMER))) {
span = cpu_online_mask;
+ }
#endif
for_each_cpu(i, span) {
int enqueue = 0;
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC v2] sched/rt: Fix RT (group) throttling with nohz_full
2021-02-02 9:00 ` [RFC v2] " Jonathan Schwender
@ 2021-02-22 13:44 ` Sebastian Andrzej Siewior
0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-02-22 13:44 UTC (permalink / raw)
To: Jonathan Schwender
Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, bristot, linux-kernel, linux-rt-users
On 2021-02-02 10:00:10 [+0100], Jonathan Schwender wrote:
> 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.
This originates from
https://lore.kernel.org/linux-rt-users/b07b6fc7-1a5f-0dcc-ca65-821de96cd8b4@gmail.com/
Could someone please take a look?
Sebastian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-22 13:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 9:34 [RFC] sched/rt: Fix RT (group) throttling with nohz_full Jonathan Schwender
2021-02-02 9:00 ` [RFC v2] " Jonathan Schwender
2021-02-22 13:44 ` Sebastian Andrzej Siewior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).