Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pid: reorder fields in pid_namespace to reduce false sharing

alloc_pid() loads pid_cachep, level and pid_max prior to taking the
lock.

It dirties idr and pid_allocated with the lock.

Some of these fields share the cacheline as is, split them up.

No change in the size of the struct.

Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Link: https://patch.msgid.link/20260120204820.1497002-1-mjguzik@gmail.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Mateusz Guzik and committed by
Christian Brauner
03aef060 80218249

+7 -7
+7 -7
include/linux/pid_namespace.h
··· 27 27 struct idr idr; 28 28 struct rcu_head rcu; 29 29 unsigned int pid_allocated; 30 + #ifdef CONFIG_SYSCTL 31 + #if defined(CONFIG_MEMFD_CREATE) 32 + int memfd_noexec_scope; 33 + #endif 34 + struct ctl_table_set set; 35 + struct ctl_table_header *sysctls; 36 + #endif 30 37 struct task_struct *child_reaper; 31 38 struct kmem_cache *pid_cachep; 32 39 unsigned int level; ··· 47 40 int reboot; /* group exit code if this pidns was rebooted */ 48 41 struct ns_common ns; 49 42 struct work_struct work; 50 - #ifdef CONFIG_SYSCTL 51 - struct ctl_table_set set; 52 - struct ctl_table_header *sysctls; 53 - #if defined(CONFIG_MEMFD_CREATE) 54 - int memfd_noexec_scope; 55 - #endif 56 - #endif 57 43 } __randomize_layout; 58 44 59 45 extern struct pid_namespace init_pid_ns;