Re: [PATCH v2 08/10] sched/fair: Add newidle balance to pick_task_fair()
From: Peter Zijlstra
Date: Tue May 12 2026 - 05:46:35 EST
On Tue, May 12, 2026 at 11:07:13AM +0530, K Prateek Nayak wrote:
> Hello Peter,
>
> On 5/11/2026 5:01 PM, Peter Zijlstra wrote:
> > @@ -9245,6 +9247,14 @@ static struct task_struct *pick_task_fai
> > if (unlikely(throttled))
> > task_throttle_setup_work(p);
> > return p;
> > +
> > +idle:
> > + new_tasks = sched_balance_newidle(rq, rf);
> > + if (new_tasks < 0)
> > + return RETRY_TASK;
> > + if (new_tasks > 0)
> > + goto again;
> > + return NULL;
> > }
>
> For core scheduling will now trigger a newidle balance during the pick
> when core_cookie is reset to 0 which can cause tasks to migrate only
> for them to find they cannot run on the CPU since core-wide selection
> leads to a cookie mismatch and it is kept hanging there.
>
> Can we return early if sched_core_enabled() here or are the additional
> newidle balance okay?
This basically makes fair behave like every other class, so in that sense
this is probably okay. That said, fair is the most common case, so
perhaps.
Lets see if the people actually using this notice first though ;-)