]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
pid: perform free_pid() calls outside of tasklist_lock
authorMateusz Guzik <mjguzik@gmail.com>
Thu, 6 Feb 2025 16:44:13 +0000 (17:44 +0100)
committerChristian Brauner <brauner@kernel.org>
Fri, 7 Feb 2025 10:22:43 +0000 (11:22 +0100)
commit7903f907a226058ed99f86e9924e082aea57fc45
tree4bcd8e6eecafe9d0b09d2d57d262e57264147094
parent74198dc2067b2aa14e411b29ce50ea3f418a43ab
pid: perform free_pid() calls outside of tasklist_lock

As the clone side already executes pid allocation with only pidmap_lock
held, issuing free_pid() while still holding tasklist_lock exacerbates
total hold time of the latter.

More things may show up later which require initial clean up with the
lock held and allow finishing without it. For that reason a struct to
collect such work is added instead of merely passing the pid array.

Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Link: https://lore.kernel.org/r/20250206164415.450051-5-mjguzik@gmail.com
Acked-by: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
include/linux/pid.h
kernel/exit.c
kernel/pid.c
kernel/sys.c