[RFC PATCH v5 25/29] sched/rt: Try pull task on empty server pick
From: Yuri Andriaccio
Date: Thu Apr 30 2026 - 17:45:43 EST
Try to pull task on a server with an empty runqueue before returning NULL (and
thus shutting down).
---
When all the servers of a cgroup are throttled, work is pending, and any one of
the servers is replenished, it may happen that the runqueue is empty and thus
the replenished server is immediately shut down.
The server may try to pull a task so that the cgroup could consume its
allocated runtime as soon as it is replenished.
Signed-off-by: Yuri Andriaccio <yurand2000@xxxxxxxxx>
---
kernel/sched/rt.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index e6b3efa358d3..4553a139398f 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -155,8 +155,14 @@ static struct task_struct *rt_server_pick(struct sched_dl_entity *dl_se, struct
struct rq *rq = rq_of_rt_rq(rt_rq);
struct task_struct *p;
- if (!sched_rt_runnable(dl_se->my_q))
- return NULL;
+ if (!sched_rt_runnable(dl_se->my_q)) {
+ rq_unpin_lock(rq, rf);
+ group_pull_rt_task(rt_rq);
+ rq_repin_lock(rq, rf);
+
+ if (!sched_rt_runnable(dl_se->my_q))
+ return NULL;
+ }
p = rt_task_of(pick_next_rt_entity(rt_rq));
set_next_task_rt(rq, p, true);
--
2.53.0