Skip to content

Commit 35c9701

Browse files
committed
exit: move wake_up_all() pidfd waiters into __unhash_process()
Move the pidfd notification out of __change_pid() and into __unhash_process(). The only valid call to __change_pid() with a NULL argument and PIDTYPE_PID is from __unhash_process(). This is a lot more obvious than calling it from __change_pid(). Link: https://lore.kernel.org/[email protected] Reviewed-by: Oleg Nesterov <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 1e940ff commit 35c9701

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

kernel/exit.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,13 @@ struct release_task_post {
133133
static void __unhash_process(struct release_task_post *post, struct task_struct *p,
134134
bool group_dead)
135135
{
136+
struct pid *pid = task_pid(p);
137+
136138
nr_threads--;
139+
137140
detach_pid(post->pids, p, PIDTYPE_PID);
141+
wake_up_all(&pid->wait_pidfd);
142+
138143
if (group_dead) {
139144
detach_pid(post->pids, p, PIDTYPE_TGID);
140145
detach_pid(post->pids, p, PIDTYPE_PGID);

kernel/pid.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,6 @@ static void __change_pid(struct pid **pids, struct task_struct *task,
359359
hlist_del_rcu(&task->pid_links[type]);
360360
*pid_ptr = new;
361361

362-
if (type == PIDTYPE_PID) {
363-
WARN_ON_ONCE(pid_has_task(pid, PIDTYPE_PID));
364-
wake_up_all(&pid->wait_pidfd);
365-
}
366-
367362
for (tmp = PIDTYPE_MAX; --tmp >= 0; )
368363
if (pid_has_task(pid, tmp))
369364
return;

0 commit comments

Comments
 (0)