Re: [PATCH v1] kthread/smpboot: Serialize kthread parking against wakeup

From: Peter Zijlstra
Date: Wed Jun 06 2018 - 11:23:02 EST


On Wed, Jun 06, 2018 at 03:51:16PM +0200, Oleg Nesterov wrote:
> On 06/05, Peter Zijlstra wrote:
> >
> > Also, I think we still need TASK_PARKED as a special state for that.
>
> I think it would be nice to kill the TASK_PARKED state altogether. But I don't
> know how. I'll try to look at this code later, but I am not sure I will find a
> way to cleanup it...

So the nice thing about having TASK_PARKED is that it guarantees no
spurious wakeups. You know the thread will not wake up while it's CPU is
gone.

We could possibly re-purpose TASK_STOPPED (because kernel threads don't
do that) but that seems dodgy at best.