Re: [PATCH] signal: break out of wait loops on kthread_stop()

From: Jason A. Donenfeld
Date: Mon Jun 27 2022 - 10:55:09 EST


On Mon, Jun 27, 2022 at 03:27:03PM +0200, Peter Zijlstra wrote:
> On Mon, Jun 27, 2022 at 02:00:20PM +0200, Jason A. Donenfeld wrote:
>
> > +bool __kthread_should_stop(struct task_struct *k)
> > +{
> > + return (k->flags & PF_KTHREAD) &&
> > + test_bit(KTHREAD_SHOULD_STOP, &to_kthread(k)->flags);
> > +}
>
> This used to be a racy pattern; not sure it still is since Eric poked at
> this last, but please use __to_kthread() instead.

Ah, indeed. Will send a v2.

Jason