lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <cvcwp4bhcragrerbux2kkedoae3stxnil26r43bv4ys2fnl7wj@le2fi3dq3vge>
Date: Wed, 21 Jan 2026 10:27:31 +0100
From: Jan Kara <jack@...e.cz>
To: Mateusz Guzik <mjguzik@...il.com>
Cc: brauner@...nel.org, viro@...iv.linux.org.uk, jack@...e.cz, 
	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] pid: reorder fields in pid_namespace to reduce false
 sharing

On Tue 20-01-26 21:48:20, Mateusz Guzik wrote:
> 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@...il.com>

Looks ok. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> ---
> 
> this is independent of other patches
> 
> i got an inconsistent win in terms of throughput rate, but relative
> contention between pidmap lock and the rest went down
> 
>  include/linux/pid_namespace.h | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> 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;
> -- 
> 2.48.1
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ