Re: [PATCH 1/2] sched/fair: Do not let idle entities preempt others

From: Madadi Vineeth Reddy
Date: Sat Feb 22 2025 - 12:49:16 EST


On 21/02/25 16:42, Abel Wu wrote:
> A task with SCHED_IDLE policy doesn't preempt others by definition, and
> the semantics are intended to be preserved when extending to cgroups
> introduced in commit 304000390f88 ("sched: Cgroup SCHED_IDLE support").

[snip]

> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 1c0ef435a7aa..4340178f29b7 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8778,12 +8778,15 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int
> pse_is_idle = se_is_idle(pse);
>
> /*
> - * Preempt an idle entity in favor of a non-idle entity (and don't preempt
> - * in the inverse case).
> + * Preempt an idle entity in favor of a non-idle entity.
> */
> if (cse_is_idle && !pse_is_idle)
> goto preempt;

This patch doesn't apply cleanly on top of tip/sched/core because of the
commit f553741ac8c0 ("sched: Cancel the slice protection of the idle entity").
Please rebase it.

Thanks,
Madadi Vineeth Reddy

> - if (cse_is_idle != pse_is_idle)
> +
> + /*
> + * IDLE entities do not preempt others.
> + */
> + if (unlikely(pse_is_idle))
> return;
>
> /*