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 <[email protected]> Signed-off-by: Mateusz Guzik <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: "Liam R. Howlett" <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 1ab2785 commit 6731cd9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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)