All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/eevdf: Delayed dequeue task can't preempt
@ 2026-07-01 16:49 Vincent Guittot
  2026-07-02  4:56 ` K Prateek Nayak
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Vincent Guittot @ 2026-07-01 16:49 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, dietmar.eggemann, rostedt, bsegall,
	mgorman, vschneid, kprateek.nayak, linux-kernel, qyousef
  Cc: Vincent Guittot

Load balancing can migrate delayed dequeue tasks to even the load between
CPUs.

sched_balance_rq()
  -> detach_task()
    -> deactivate_task(DEQUEUE_NOCLOCK)
    -> set_task_cpu(dst_cpu)

  -> attach_task()
    -> activate_task(ENQUEUE_NOCLOCK)
    -> wakeup_preempt()

A delayed task with shorter slice can be dequeued during pick_next_entity()
but then jump to preempt because eligible.

Always jump to update for delayed dequeue task even with shorter slice.

Fixes: ba0d3bf5f97b ("sched/eevdf: Cancel slice protection if short slice task is eligible")
Reported-by: K Prateek Nayak <kprateek.nayak@amd.com>
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
---
 kernel/sched/fair.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index fc6cd55f9d22..df8c9c2c7918 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9948,6 +9948,13 @@ static void wakeup_preempt_fair(struct rq *rq, struct task_struct *p, int wake_f
 	if (unlikely(!normal_policy(p->policy)))
 		goto update;
 
+	/*
+	 * Do not preempt for tasks that are sched_delayed as it would violate
+	 * EEVDF to forcibly queue an ineligible task.
+	 */
+	if (pse->sched_delayed)
+		goto update;
+
 	/*
 	 * If @p has a shorter slice than current and @p is eligible, override
 	 * current's slice protection in order to allow preemption.
@@ -9959,11 +9966,9 @@ static void wakeup_preempt_fair(struct rq *rq, struct task_struct *p, int wake_f
 
 	/*
 	 * Ignore wakee preemption on WF_FORK as it is less likely that
-	 * there is shared data as exec often follow fork. Do not
-	 * preempt for tasks that are sched_delayed as it would violate
-	 * EEVDF to forcibly queue an ineligible task.
+	 * there is shared data as exec often follow fork.
 	 */
-	if ((wake_flags & WF_FORK) || pse->sched_delayed)
+	if (wake_flags & WF_FORK)
 		goto update;
 
 	/* Prefer picking wakee soon if appropriate. */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-07-02  9:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 16:49 [PATCH] sched/eevdf: Delayed dequeue task can't preempt Vincent Guittot
2026-07-02  4:56 ` K Prateek Nayak
2026-07-02  7:51   ` Vincent Guittot
2026-07-02  7:43 ` Peter Zijlstra
2026-07-02  7:53   ` Vincent Guittot
2026-07-02  9:01     ` Peter Zijlstra
2026-07-02  9:07       ` Vincent Guittot
2026-07-02  7:47 ` [tip: sched/core] " tip-bot2 for Vincent Guittot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.