[<prev] [next>] [day] [month] [year] [list]
Message-ID: <175810912711.709179.3678143545870319102.tip-bot2@tip-bot2>
Date: Wed, 17 Sep 2025 11:38:47 -0000
From: "tip-bot2 for Fernand Sieber" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Fernand Sieber <sieberf@...zon.com>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: sched/urgent] sched/fair: Forfeit vruntime on yield()
The following commit has been merged into the sched/urgent branch of tip:
Commit-ID: 78f8764d34c0a1912ce209bb2a428a94d062707f
Gitweb: https://git.kernel.org/tip/78f8764d34c0a1912ce209bb2a428a94d062707f
Author: Fernand Sieber <sieberf@...zon.com>
AuthorDate: Tue, 16 Sep 2025 16:02:28 +02:00
Committer: Peter Zijlstra <peterz@...radead.org>
CommitterDate: Tue, 16 Sep 2025 16:44:12 +02:00
sched/fair: Forfeit vruntime on yield()
If a task yields, the scheduler may decide to pick it again. The task in
turn may decide to yield immediately or shortly after, leading to a tight
loop of yields.
If there's another runnable task as this point, the deadline will be
increased by the slice at each loop. This can cause the deadline to runaway
pretty quickly, and subsequent elevated run delays later on as the task
doesn't get picked again. The reason the scheduler can pick the same task
again and again despite its deadline increasing is because it may be the
only eligible task at that point.
Fix this by making the task forfeiting its remaining vruntime and pushing
the deadline one slice ahead. This implements yield behavior more
authentically.
Fixes: 147f3efaa24182 ("sched/fair: Implement an EEVDF-like scheduling policy")
Signed-off-by: Fernand Sieber <sieberf@...zon.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Link: https://lore.kernel.org/r/20250401123622.584018-1-sieberf@amazon.com
Link: https://lore.kernel.org/r/20250911095113.203439-1-sieberf@amazon.com
---
kernel/sched/fair.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index b173a05..c4d91e8 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8921,6 +8921,7 @@ static void yield_task_fair(struct rq *rq)
*/
rq_clock_skip_update(rq);
+ se->vruntime = se->deadline;
se->deadline += calc_delta_fair(se->slice, se);
}
Powered by blists - more mailing lists