Skip to content

Commit 24822b1

Browse files
committed
sched/fair: Fix pelt lost idle time detection
JIRA: https://issues.redhat.com/browse/RHEL-128251 commit 17e3e88 Author: Vincent Guittot <vincent.guittot@linaro.org> Date: Wed Oct 8 15:12:14 2025 +0200 sched/fair: Fix pelt lost idle time detection The check for some lost idle pelt time should be always done when pick_next_task_fair() fails to pick a task and not only when we call it from the fair fast-path. The case happens when the last running task on rq is a RT or DL task. When the latter goes to sleep and the /Sum of util_sum of the rq is at the max value, we don't account the lost of idle time whereas we should. Fixes: 6769243 ("sched: Rework pick_next_task() slow-path") Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Phil Auld <pauld@redhat.com>
1 parent 3d817ed commit 24822b1

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

kernel/sched/fair.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8489,21 +8489,21 @@ done: __maybe_unused;
84898489
return p;
84908490

84918491
idle:
8492-
if (!rf)
8493-
return NULL;
8494-
8495-
new_tasks = sched_balance_newidle(rq, rf);
8492+
if (rf) {
8493+
new_tasks = sched_balance_newidle(rq, rf);
84968494

8497-
/*
8498-
* Because sched_balance_newidle() releases (and re-acquires) rq->lock, it is
8499-
* possible for any higher priority task to appear. In that case we
8500-
* must re-start the pick_next_entity() loop.
8501-
*/
8502-
if (new_tasks < 0)
8503-
return RETRY_TASK;
8495+
/*
8496+
* Because sched_balance_newidle() releases (and re-acquires)
8497+
* rq->lock, it is possible for any higher priority task to
8498+
* appear. In that case we must re-start the pick_next_entity()
8499+
* loop.
8500+
*/
8501+
if (new_tasks < 0)
8502+
return RETRY_TASK;
85048503

8505-
if (new_tasks > 0)
8506-
goto again;
8504+
if (new_tasks > 0)
8505+
goto again;
8506+
}
85078507

85088508
/*
85098509
* rq is about to be idle, check if we need to update the

0 commit comments

Comments
 (0)