Messages in this thread | | | Date | Mon, 14 Jun 2021 17:42:47 +0200 | From | Oleg Nesterov <> | Subject | Re: [PATCH] freezer,sched: Rewrite core freezer logic |
| |
Hi Peter, sorry for delay,
On 06/11, Peter Zijlstra wrote: > > +/* Recursion relies on tail-call optimization to not blow away the stack */ > +static bool __frozen(struct task_struct *p) > +{ > + if (p->state == TASK_FROZEN) > + return true; > + > + /* > + * If stuck in TRACED, and the ptracer is FROZEN, we're frozen too. > + */ > + if (task_is_traced(p)) > + return frozen(rcu_dereference(p->parent));
Why does it use frozen(), not __frozen() ?
This looks racy, p->parent can resume this task and then enter __refrigerator().
Plus this task can be SIGKILL'ed even if it is traced.
> + /* > + * If stuck in STOPPED and the parent is FROZEN, we're frozen too. > + */ > + if (task_is_stopped(p)) > + return frozen(rcu_dereference(p->real_parent));
(you could use ->parent in this case too and unify this check with the "traced" case above)
I don't understand. How this connects to ->parent or ->real_parent? SIGCONT can come from anywhere and wake this stopped task up?
I guess you do this to avoid freezable_schedule() in ptrace/signal_stop, and we can't use TASK_STOPPED|TASK_FREEZABLE, it should not run after thaw()... But see above, we can't rely on __frozen(parent).
Oleg.
| |