Commit d9b4357
committed
sched/fair: Block delayed tasks on throttled hierarchy during dequeue
JIRA: https://issues.redhat.com/browse/RHEL-69492
Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git (v6.12.54)
CONFLICTS: minor context conflict in the first chunk of the patch.
commit e67e3e7
Author: K Prateek Nayak <kprateek.nayak@amd.com>
Date: Wed Oct 15 06:03:59 2025 +0000
sched/fair: Block delayed tasks on throttled hierarchy during dequeue
Dequeuing a fair task on a throttled hierarchy returns early on
encountering a throttled cfs_rq since the throttle path has already
dequeued the hierarchy above and has adjusted the h_nr_* accounting till
the root cfs_rq.
dequeue_entities() crucially misses calling __block_task() for delayed
tasks being dequeued on the throttled hierarchies, but this was mostly
harmless until commit b7ca574 ("sched/core: Tweak
wait_task_inactive() to force dequeue sched_delayed tasks") since all
existing cases would re-enqueue the task if task_on_rq_queued() returned
true and the task would eventually be blocked at pick after the
hierarchy was unthrottled.
wait_task_inactive() is special as it expects the delayed task on
throttled hierarchy to reach the blocked state on dequeue but since
__block_task() is never called, task_on_rq_queued() continues to return
true. Furthermore, since the task is now off the hierarchy, the pick
never reaches it to fully block the task even after unthrottle leading
to wait_task_inactive() looping endlessly.
Remedy this by calling __block_task() if a delayed task is being
dequeued on a throttled hierarchy.
This fix is only required for stabled kernels implementing delay dequeue
(>= v6.12) before v6.18 since upstream commit e1fad12 ("sched/fair:
Switch to task based throttle model") indirectly fixes this by removing
the early return conditions in dequeue_entities() as part of the per-task
throttle feature.
Cc: stable@vger.kernel.org
Reported-by: Matt Fleming <matt@readmodwrite.com>
Closes: https://lore.kernel.org/all/20250925133310.1843863-1-matt@readmodwrite.com/
Fixes: b7ca574 ("sched/core: Tweak wait_task_inactive() to force dequeue sched_delayed tasks")
Tested-by: Matt Fleming <mfleming@cloudflare.com>
Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>1 parent b8bd692 commit d9b4357
1 file changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7064 | 7064 | | |
7065 | 7065 | | |
7066 | 7066 | | |
| 7067 | + | |
7067 | 7068 | | |
7068 | 7069 | | |
7069 | 7070 | | |
| |||
7093 | 7094 | | |
7094 | 7095 | | |
7095 | 7096 | | |
7096 | | - | |
| 7097 | + | |
7097 | 7098 | | |
7098 | 7099 | | |
7099 | 7100 | | |
| |||
7132 | 7133 | | |
7133 | 7134 | | |
7134 | 7135 | | |
7135 | | - | |
| 7136 | + | |
7136 | 7137 | | |
7137 | 7138 | | |
7138 | 7139 | | |
| |||
7141 | 7142 | | |
7142 | 7143 | | |
7143 | 7144 | | |
| 7145 | + | |
| 7146 | + | |
7144 | 7147 | | |
7145 | 7148 | | |
7146 | 7149 | | |
| |||
7156 | 7159 | | |
7157 | 7160 | | |
7158 | 7161 | | |
7159 | | - | |
| 7162 | + | |
7160 | 7163 | | |
7161 | 7164 | | |
7162 | 7165 | | |
| |||
0 commit comments