Re: [RFC PATCH v15 5/7] sched: Add an initial sketch of the find_proxy_task() function

Peter Zijlstra
2025-03-17T13:48:48Z

On Wed, Mar 12, 2025 at 03:11:35PM -0700, John Stultz wrote:
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index 4b8e33c615b12..2d418e0efecc5 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -1479,8 +1479,19 @@ enqueue_task_rt(struct rq *rq, struct task_struct *p, int flags)
>
> enqueue_rt_entity(rt_se, flags);
>
> - if (!task_current(rq, p) && p->nr_cpus_allowed > 1)
> - enqueue_pushable_task(rq, p);
> + /*
> + * Current can't be pushed away. Selected is tied to current,
> + * so don't push it either.
> + */
> + if (task_current(rq, p) || task_current_donor(rq, p))
> + return;
> + /*
> + * Pinned tasks can't be pushed.
> + */
> + if (p->nr_cpus_allowed == 1)
> + return;
> +
> + enqueue_pushable_task(rq, p);
> }
>

As per always, deadline.c will have the exact same logic.