[PATCH 0/1] cgroup: avoid the unnecessary list_add(dying_tasks) in cgroup_exit()
From: Oleg Nesterov
Date: Mon Jun 17 2024 - 11:45:59 EST
Hello,
Sorry for delay and for confusing you in our previous discussion
here https://lore.kernel.org/all/20240610105028.GA21586@xxxxxxxxxx/
No, cgroup_exit() can't rely on group_dead, this is racy.
And no, we can't shift css_set_skip_task_iters/etc from cgroup_release()
to cgroup_exit(), an execing sub-thread can change the group leader.
Let me at least send the simple patch which looks "obviously good" to me.
I would really like to remove the usage of signal->live in cgroup.c, but
so far I do not see a simple solution.
With or without this change cgroup.procs can be empty but cgroup.threads
is not. But at least the exiting sub-threads which have already passed
atomic_dec_and_test() should call cgroup_exit() "soon".
Oleg.