This is probably carrying over code from cpuset.c, but :
/me thinks that there is a ugly race here with 'tsk' exiting.
What happens if the tsk is marked PF_EXITING just after this check?
If that happens, then:
Above assignment A1 can race with below assignment A2 in container_exit() :
tsk->container = &top_container; /* the_top_container_hack - see above */
What happens if A1 follows after A2? I feel very uncomfortable abt it.
IMO, we need to use task_lock() in container_exit() to avoid this race.
(I think this race already exists in mainline cpuset.c?)
P.S : cpuset.c checks for PF_EXITING twice in attach_task(), while this
patch seems to be checking only once. Is that fine?
--
Regards,
vatsa
-