Skip to content

Commit

Permalink
cgroup: Call cgroup_release() before __exit_signal()
Browse files Browse the repository at this point in the history
commit 6b115bf58e6f013ca75e7115aabcbd56c20ff31d upstream.

cgroup_release() calls cgroup_subsys->release() which is used by the
pids controller to uncharge its pid.  We want to use it to manage
iteration of dying tasks which requires putting it before
__unhash_process().  Move cgroup_release() above __exit_signal().
While this makes it uncharge before the pid is freed, pid is RCU freed
anyway and the window is very narrow.

Signed-off-by: Tejun Heo <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
htejun authored and gregkh committed Aug 9, 2019
1 parent e6e9bce commit 7528e95
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ void release_task(struct task_struct *p)
rcu_read_unlock();

proc_flush_task(p);
cgroup_release(p);

write_lock_irq(&tasklist_lock);
ptrace_release_task(p);
Expand All @@ -219,7 +220,6 @@ void release_task(struct task_struct *p)
}

write_unlock_irq(&tasklist_lock);
cgroup_release(p);
release_thread(p);
call_rcu(&p->rcu, delayed_put_task_struct);

Expand Down

0 comments on commit 7528e95

Please sign in to comment.