Re: [PATCH 1/5] sched: Add TIF_NEED_RESCHED_LAZY infrastructure

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


On Wed, Oct 09, 2024 at 02:18:59PM +0200, Sebastian Andrzej Siewior wrote:
> On 2024-10-07 09:46:10 [+0200], Peter Zijlstra wrote:
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -964,9 +963,9 @@ static bool set_nr_if_polling(struct tas
> > }
> >
> > #else
> > -static inline bool set_nr_and_not_polling(struct task_struct *p)
> > +static inline bool set_nr_and_not_polling(struct thread_info *ti, int tif)
> > {
> > - set_tsk_need_resched(p);
> > + atomic_long_or(1 << tif, (atomic_long_t *)&ti->flags);
>
> set_ti_thread_flag(ti, tif);
> ?
> Not sure if there is a benefit over atomic_long_or() but you could avoid
> the left shift. I know. Performance critical.

:-)

Yeah, I suppose set_ti_thread_flag() works just fine here.