summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorVincent Guittot <vincent.guittot@linaro.org>2026-06-24 17:12:28 +0200
committerPeter Zijlstra <peterz@infradead.org>2026-06-30 10:56:55 +0200
commit7cd2ef17de5e11612001e98b6319f1793239b243 (patch)
tree32ea26c7fc3066d670a15d257ef8e485d716b4b3 /kernel
parentba0d3bf5f97b74ee1cf8ea6cc35efe5a052514a4 (diff)
downloadlinux-next-7cd2ef17de5e11612001e98b6319f1793239b243.tar.gz
linux-next-7cd2ef17de5e11612001e98b6319f1793239b243.zip
sched/eevdf: Always update slice protection
Even if p will not preempt current, it modifies the avg_vruntime and possibly the min slice. Make sure to update the slice protection with the updated figures. As an example, Batch and Sched Idle tasks can otherwise get a larger lag than their slice and finaly delay the scheduling of a normal task, which deadline will be a later. Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: K Prateek Nayak <kprateek.nayak@amd.com> Link: https://patch.msgid.link/20260624151229.1710703-6-vincent.guittot@linaro.org
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/fair.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 9046b2ea68c6..2547a97921ac 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9867,16 +9867,17 @@ static void wakeup_preempt_fair(struct rq *rq, struct task_struct *p, int wake_f
if (cse_is_idle && !pse_is_idle)
goto preempt;
+ update_curr_fair(rq);
+
if (cse_is_idle != pse_is_idle)
- return;
+ goto update;
/*
* BATCH and IDLE tasks do not preempt others.
*/
if (unlikely(!normal_policy(p->policy)))
- return;
+ goto update;
- update_curr_fair(rq);
/*
* If @p has a shorter slice than current and @p is eligible, override
* current's slice protection in order to allow preemption.
@@ -9893,7 +9894,7 @@ static void wakeup_preempt_fair(struct rq *rq, struct task_struct *p, int wake_f
* EEVDF to forcibly queue an ineligible task.
*/
if ((wake_flags & WF_FORK) || pse->sched_delayed)
- return;
+ goto update;
/* Prefer picking wakee soon if appropriate. */
if (sched_feat(NEXT_BUDDY) && set_preempt_buddy(cfs_rq, pse)) {
@@ -9934,7 +9935,7 @@ pick:
*/
if (preempt_action == PREEMPT_WAKEUP_SHORT && entity_eligible(cfs_rq, pse))
goto preempt;
-
+update:
if (sched_feat(RUN_TO_PARITY))
update_protect_slice(cfs_rq, se);