mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
sched/fair: Set next buddy for preempt short
If a shorter slice task can preempt current at wakeup, we make sure that the decision will not be overwritten in between by setting the task as the next buddy. This still implies that the waking task remains eligible when the scheduler will actually pick the next task to run. 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-2-vincent.guittot@linaro.org
This commit is contained in:
committed by
Peter Zijlstra
parent
3cd1f657fa
commit
8f97b627ff
+10
-1
@@ -9757,6 +9757,15 @@ static inline bool set_preempt_buddy(struct cfs_rq *cfs_rq, struct sched_entity
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool set_short_buddy(struct cfs_rq *cfs_rq, struct sched_entity *pse)
|
||||
{
|
||||
if (cfs_rq->next && cfs_rq->next->slice < pse->slice)
|
||||
return false;
|
||||
|
||||
set_next_buddy(cfs_rq, pse);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* WF_SYNC|WF_TTWU indicates the waker expects to sleep but it is not
|
||||
* strictly enforced because the hint is either misunderstood or
|
||||
@@ -9931,7 +9940,7 @@ pick:
|
||||
preempt:
|
||||
if (preempt_action == PREEMPT_WAKEUP_SHORT) {
|
||||
cancel_protect_slice(se);
|
||||
clear_buddies(cfs_rq, se);
|
||||
set_short_buddy(cfs_rq, pse);
|
||||
}
|
||||
|
||||
resched_curr_lazy(rq);
|
||||
|
||||
Reference in New Issue
Block a user