Re: [RFC PATCH 2/3] sched/core: Fix forceidle when lock owner has mismatchd cookie
From: John Stultz
Date: Wed Jul 22 2026 - 23:18:58 EST
On Fri, Jul 17, 2026 at 4:17 AM K Prateek Nayak <kprateek.nayak@xxxxxxx> wrote:
>
> Move Vasily's fix from 7cd4088f70e0 ("sched/core: Don't proxy-exec
> unmatched cookie lock owners") into a separate helper and fix the
> forceidle stats, balance callback queuing when rq is not the one
> dictating the core cookie.
>
> The helper will be extended in subsequent commits to allow for re-pick
> with cookie from the lock owner if rq is the pick leader.
>
> Signed-off-by: K Prateek Nayak <kprateek.nayak@xxxxxxx>
Thanks again for sending these out. I've included these in my full
proxy-exec-WIP tree and ran into a few build issues with this one.
> ---
> kernel/sched/core.c | 43 ++++++++++++++++++++++++++++++++++++-------
> 1 file changed, 36 insertions(+), 7 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 31fa6bcee616..ed11410f1416 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -6598,6 +6598,8 @@ __pick_next_task(struct rq *rq, struct rq_flags *rf)
> BUG(); /* The idle class should always have a runnable task. */
> }
>
> +static void proxy_deactivate(struct rq *rq, struct task_struct *donor);
> +
So this should probably go in a "#ifdef CONFIG_SCHED_PROXY_EXEC"
block, or in the !SCHED_PROXY_EXEC case you get defined but not used
warnings.
> @@ -7113,6 +7132,18 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
> return __pick_next_task(rq, rf);
> }
>
> +static struct task_struct *
> +sched_core_swap_pick(struct rq *rq, struct task_struct *next)
> +{
> + /*
> + * Caller should always check !sched_cpu_cookie_match(rq, next)
> + * which is always false for !CONFIG_SCHED_CORE and execution
> + * should never reach here.
> + */
> + BUG_ON();
This should just be BUG()
I'll fold these fixes up into the patch in my tree, but wanted to give
you a heads up should you intend to resend these out for review
sooner.
thanks
-john