exit: combine work under lock in synchronize_group_exit() and coredump_task_exit()
authorMateusz Guzik <mjguzik@gmail.com>
Wed, 19 Mar 2025 19:54:36 +0000 (20:54 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 May 2025 00:54:07 +0000 (17:54 -0700)
commitfe6f600c43e0931f4fb5e1debb2311b7a6ebabd8
treed1ffa033fa5cc6900f2c5192bed95e716668750a
parent3eff6a3e574c2f704f9be1f4867c3d0b3d804435
exit: combine work under lock in synchronize_group_exit() and coredump_task_exit()

This reduces single-threaded overhead as it avoids one lock+irq trip on
exit.

It also improves scalability of spawning and killing threads within one
process (just shy of 5% when doing it on 24 cores on my test jig).

Both routines are moved below kcov and kmsan exit, which should be
harmless.

Link: https://lkml.kernel.org/r/20250319195436.1864415-1-mjguzik@gmail.com
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/exit.c