Commit 17e3e88e authored by Vincent Guittot's avatar Vincent Guittot Committed by Peter Zijlstra
Browse files

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: 67692435 ("sched: Rework pick_next_task() slow-path")
Signed-off-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
parent ee6e44df
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -8920,21 +8920,21 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf
	return p;

idle:
	if (!rf)
		return NULL;

	if (rf) {
		new_tasks = sched_balance_newidle(rq, rf);

		/*
	 * Because sched_balance_newidle() releases (and re-acquires) rq->lock, it is
	 * possible for any higher priority task to appear. In that case we
	 * must re-start the pick_next_entity() loop.
		 * Because sched_balance_newidle() releases (and re-acquires)
		 * rq->lock, it is possible for any higher priority task to
		 * appear. In that case we must re-start the pick_next_entity()
		 * loop.
		 */
		if (new_tasks < 0)
			return RETRY_TASK;

		if (new_tasks > 0)
			goto again;
	}

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