Re: [PATCH] sched/fair: align proxy wakeup buddy handling with EEVDF

From: Vincent Guittot

Date: Mon Jul 06 2026 - 04:40:49 EST


On Mon, 6 Jul 2026 at 04:34, zhidao su (Xiaomi) <soolaugust@xxxxxxxxx> wrote:
>
> Proxy execution still nominates a newly woken task as NEXT_BUDDY
> before the wakeup path has passed the same policy and EEVDF
> eligibility gates used by the updated fair scheduler wakeup logic.
>
> Move the NEXT_BUDDY nomination later in check_preempt_wakeup_fair()
> so throttled, already-rescheduled, disabled-preemption, idle-class,
> and non-normal wakeups return before updating cfs_rq->next.
>
> Also clear stale buddy state when PREEMPT_SHORT overrides slice
> protection.
>
> Signed-off-by: zhidao su (Xiaomi) <soolaugust@xxxxxxxxx>
> ---
> kernel/sched/fair.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 1f1c53c7deb2b..6a6cf8019be90 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8755,10 +8755,6 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int

Which version are you using ? there is nothing like
check_preempt_wakeup_fair() in mainline or tip/sched/core

And does the issue still apply with the latest scheduler changes?


> if (task_is_throttled(p))
> return;
>
> - if (sched_feat(NEXT_BUDDY) && !(wake_flags & WF_FORK) && !pse->sched_delayed) {
> - set_next_buddy(pse);
> - }
> -
> /*
> * We can come here with TIF_NEED_RESCHED already set from new task
> * wake up path.
> @@ -8811,6 +8807,9 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int
> */
> do_preempt_short = sched_feat(PREEMPT_SHORT) && (pse->slice < se->slice);
>
> + if (sched_feat(NEXT_BUDDY) && !(wake_flags & WF_FORK) && !pse->sched_delayed)
> + set_next_buddy(pse);
> +
> /*
> * If @p has become the most eligible task, force preemption.
> */
> @@ -8823,8 +8822,10 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int
> return;
>
> preempt:
> - if (do_preempt_short)
> + if (do_preempt_short) {
> cancel_protect_slice(se);
> + clear_buddies(cfs_rq, se);
> + }
>
> resched_curr_lazy(rq);
> }
> --
> 2.43.0
>