summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMateusz Guzik <mjguzik@gmail.com>2026-01-20 19:45:39 +0100
committerChristian Brauner <brauner@kernel.org>2026-02-10 11:39:30 +0100
commit87caaeef79950377b616f3ba2265a82742cb9583 (patch)
tree3fbb4b2422a16c5eb727ad5db23bb1df39d64842 /kernel
parent03aef0602f22f30aab0e42e7f3169b0a5920c461 (diff)
pidfs: implement ino allocation without the pidmap lock
This paves the way for scalable PID allocation later. The 32 bit variant merely takes a spinlock for simplicity, the 64 bit variant uses a scalable scheme. Signed-off-by: Mateusz Guzik <mjguzik@gmail.com> Link: https://patch.msgid.link/20260120184539.1480930-1-mjguzik@gmail.com Co-developed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/pid.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/pid.c b/kernel/pid.c
index 06356e40ac00..72c9372b84b8 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -198,6 +198,7 @@ struct pid *alloc_pid(struct pid_namespace *ns, pid_t *arg_set_tid,
INIT_HLIST_HEAD(&pid->tasks[type]);
init_waitqueue_head(&pid->wait_pidfd);
INIT_HLIST_HEAD(&pid->inodes);
+ pidfs_prepare_pid(pid);
/*
* 2. perm check checkpoint_restore_ns_capable()
@@ -314,8 +315,6 @@ struct pid *alloc_pid(struct pid_namespace *ns, pid_t *arg_set_tid,
retval = -ENOMEM;
if (unlikely(!(ns->pid_allocated & PIDNS_ADDING)))
goto out_free;
- pidfs_prepare_pid(pid);
-
for (upid = pid->numbers + ns->level; upid >= pid->numbers; --upid) {
/* Make the PID visible to find_pid_ns. */
idr_replace(&upid->ns->idr, pid, upid->nr);