summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-16 12:37:13 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-16 12:37:13 -0800
commit543b9b63394ee67ecf5298fe42cbe65b21a16eac (patch)
treeddae1ef25280398551cf0077799e0a51dc3363b4 /include
parent57d76ceccee4b497eb835831206b50e72915a501 (diff)
parent3673dd3c7dc1f37baf0448164d323d7c7a44d1da (diff)
Merge tag 'kernel-7.0-rc1.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull pidfs updates from Christian Brauner: - pid: introduce task_ppid_vnr() helper - pidfs: convert rb-tree to rhashtable Mateusz reported performance penalties during task creation because pidfs uses pidmap_lock to add elements into the rbtree. Switch to an rhashtable to have separate fine-grained locking and to decouple from pidmap_lock moving all heavy manipulations outside of it Also move inode allocation outside of pidmap_lock. With this there's nothing happening for pidfs under pidmap_lock - pid: reorder fields in pid_namespace to reduce false sharing - Revert "pid: make __task_pid_nr_ns(ns => NULL) safe for zombie callers" - ipc: Add SPDX license id to mqueue.c * tag 'kernel-7.0-rc1.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: pid: introduce task_ppid_vnr() helper pidfs: implement ino allocation without the pidmap lock Revert "pid: make __task_pid_nr_ns(ns => NULL) safe for zombie callers" pid: reorder fields in pid_namespace to reduce false sharing pidfs: convert rb-tree to rhashtable ipc: Add SPDX license id to mqueue.c
Diffstat (limited to 'include')
-rw-r--r--include/linux/pid.h9
-rw-r--r--include/linux/pid_namespace.h14
-rw-r--r--include/linux/pidfs.h3
3 files changed, 16 insertions, 10 deletions
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 003a1027d219..ddaef0bbc8ba 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -6,6 +6,7 @@
#include <linux/rculist.h>
#include <linux/rcupdate.h>
#include <linux/refcount.h>
+#include <linux/rhashtable-types.h>
#include <linux/sched.h>
#include <linux/wait.h>
@@ -60,7 +61,7 @@ struct pid {
spinlock_t lock;
struct {
u64 ino;
- struct rb_node pidfs_node;
+ struct rhash_head pidfs_hash;
struct dentry *stashed;
struct pidfs_attr *attr;
};
@@ -73,7 +74,6 @@ struct pid {
struct upid numbers[];
};
-extern seqcount_spinlock_t pidmap_lock_seq;
extern struct pid init_struct_pid;
struct file;
@@ -310,6 +310,11 @@ static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_na
return pid;
}
+static inline pid_t task_ppid_vnr(const struct task_struct *tsk)
+{
+ return task_ppid_nr_ns(tsk, NULL);
+}
+
static inline pid_t task_ppid_nr(const struct task_struct *tsk)
{
return task_ppid_nr_ns(tsk, &init_pid_ns);
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 0e7ae12c96d2..b20baaa7e62b 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -27,6 +27,13 @@ struct pid_namespace {
struct idr idr;
struct rcu_head rcu;
unsigned int pid_allocated;
+#ifdef CONFIG_SYSCTL
+#if defined(CONFIG_MEMFD_CREATE)
+ int memfd_noexec_scope;
+#endif
+ struct ctl_table_set set;
+ struct ctl_table_header *sysctls;
+#endif
struct task_struct *child_reaper;
struct kmem_cache *pid_cachep;
unsigned int level;
@@ -40,13 +47,6 @@ struct pid_namespace {
int reboot; /* group exit code if this pidns was rebooted */
struct ns_common ns;
struct work_struct work;
-#ifdef CONFIG_SYSCTL
- struct ctl_table_set set;
- struct ctl_table_header *sysctls;
-#if defined(CONFIG_MEMFD_CREATE)
- int memfd_noexec_scope;
-#endif
-#endif
} __randomize_layout;
extern struct pid_namespace init_pid_ns;
diff --git a/include/linux/pidfs.h b/include/linux/pidfs.h
index 3e08c33da2df..416bdff4d6ce 100644
--- a/include/linux/pidfs.h
+++ b/include/linux/pidfs.h
@@ -6,7 +6,8 @@ struct coredump_params;
struct file *pidfs_alloc_file(struct pid *pid, unsigned int flags);
void __init pidfs_init(void);
-void pidfs_add_pid(struct pid *pid);
+void pidfs_prepare_pid(struct pid *pid);
+int pidfs_add_pid(struct pid *pid);
void pidfs_remove_pid(struct pid *pid);
void pidfs_exit(struct task_struct *tsk);
#ifdef CONFIG_COREDUMP