Re: [PATCH] signal: break out of wait loops on kthread_stop()
From: Peter Zijlstra
Date: Mon Jun 27 2022 - 09:27:20 EST
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.