Re: [PATCH] freezer,sched: Rewrite core freezer logic

From: Oleg Nesterov
Date: Tue Jun 15 2021 - 11:45:51 EST


On 06/14, Peter Zijlstra wrote:
>
> One more thing; if I add additional state bits to preserve
> __TASK_{TRACED,STOPPED}, then I need to figure out at thaw time if we've
> missed a wakeup or not.
>
> Do we have sufficient state for that? If so, don't we then also not have
> sufficient state to tell if a task should've been TRACED/STOPPED in the
> first place?

Not sure I understand you, probably not, but I think the answer is "no" ;)

But this reminds me... can't we implement selective wakeups? So that if a
task T sleeps in state = STOPPED | FROZEN, then ttwu(T, FROZEN) won't wake
it up, it will only clear FROZEN from T->state. Similarly, ttwu(T, STOPPED)
will leave this task with state == FROZEN.

See also

https://lore.kernel.org/lkml/20131112162136.GA29065@xxxxxxxxxx/
https://lore.kernel.org/lkml/20131113170724.GA17739@xxxxxxxxxx/

just to remind you that we already discussed TASK_FROZEN a little bit almost
10 years ago ;)

What has been shall be, and what has been done is what will be done, and
there is nothing new under the sun.

Oleg.