Messages in this thread | | | Date | Tue, 9 May 2023 12:03:48 +0200 | From | Michal Koutný <> | Subject | Re: [RFC PATCH] cgroup: Return error when attempting to migrate a zombie process |
| |
On Fri, May 05, 2023 at 09:04:37AM -1000, Tejun Heo <tj@kernel.org> wrote: > This seems racy to me. The liveness state can change between here and the > PF_EXITING check in cgroup_migrate_add_task(), right?
You're right, threadgroup lock won't prevent that (as I got wrongly in the patch):
cgroup_procs_write_start do_exit exit_signals cgroup_threadgroup_change_begin tsk->flags |= PF_EXITING cgroup_threadgroup_change_end percpu_down_write(&cgroup_threadgroup_rwsem) ... atomic_read(&live) ... atomic_dec_and_test(live) ... cgroup_migrate_add_task ... percpu_up_write(&cgroup_threadgroup_rwsem)
> Wouldn't it be better to just track how many tasks are tracked and > return -ESRCH if none was migrated?
Thanks, such an integral sounds better, will see.
Michal [unhandled content-type:application/pgp-signature] | |