lkml.org 
[lkml]   [2023]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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]
\
 
 \ /
  Last update: 2023-05-09 12:04    [W:0.035 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site