Skip to content

Commit 6731cd9

Browse files
mjguzikbrauner
authored andcommitted
exit: hoist get_pid() in release_task() outside of tasklist_lock
Reduces hold time as get_pid() contains an atomic. Reviewed-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Mateusz Guzik <mjguzik@gmail.com> Link: https://lore.kernel.org/r/20250206164415.450051-3-mjguzik@gmail.com Acked-by: "Liam R. Howlett" <Liam.Howlett@Oracle.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 1ab2785 commit 6731cd9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

kernel/exit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,10 @@ void release_task(struct task_struct *p)
240240

241241
cgroup_release(p);
242242

243+
thread_pid = get_pid(p->thread_pid);
244+
243245
write_lock_irq(&tasklist_lock);
244246
ptrace_release_task(p);
245-
thread_pid = get_pid(p->thread_pid);
246247
__exit_signal(p);
247248

248249
/*

0 commit comments

Comments
 (0)