Re: [PATCH 0/5] sched: Lazy preemption muck

From: Peter Zijlstra
Date: Wed Oct 09 2024 - 04:02:24 EST


On Wed, Oct 09, 2024 at 08:20:19AM +0200, Sebastian Andrzej Siewior wrote:
> On 2024-10-08 21:40:05 [-0700], Ankur Arora wrote:
> > > While comparing this vs what I have:
> > > - need_resched()
> > > It checked both (tif_need_resched_lazy() || tif_need_resched()) while
> > > now it only looks at tif_need_resched().
> > > Also ensured that raw_irqentry_exit_cond_resched() does not trigger on
> > > lazy.
> > > I guess you can argue both ways what makes sense, just noting…
> >
> > I think we want need_resched() to be only tif_need_resched(). That way
> > preemption in lazy mode *only* happens at the user mode boundary.
>
> There are places such as __clear_extent_bit() or select_collect() where
> need_resched() is checked and if 0 they loop again. For these kind of
> users it would probably make sense to allow them to preempt themself.
> We could also add a new function which checks both and audit all users
> and check what would make sense base on $criteria.

Do we really need this -- wasn't the idea to have thing 'delay' until
the actual NEED_RESCHED bit gets set?