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] [thread-next>] [day] [month] [year] [list]
Message-ID: <YeBVWmUaSXc/5NQf@slm.duckdns.org>
Date:   Thu, 13 Jan 2022 06:37:46 -1000
From:   Tejun Heo <tj@...nel.org>
To:     Imran Khan <imran.f.khan@...cle.com>
Cc:     gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/2] kernfs: use hashed mutex and spinlock in place of
 global ones.

Hello,

On Thu, Jan 13, 2022 at 09:42:58PM +1100, Imran Khan wrote:
> +#ifdef CONFIG_SMP
> +#define NR_KERNFS_LOCK_BITS (2 * (ilog2(NR_CPUS < 32 ? NR_CPUS : 32)))

How did the 32 limit come to be? It'd be nice to have a comment explaining
that this is something which affects scalability and brief rationale on the
current number.

> +static inline spinlock_t *open_node_lock_ptr(struct kernfs_node *kn)
> +{
> +	int index = hash_ptr(kn, NR_KERNFS_LOCK_BITS);
> +
> +	return &kernfs_global_locks.open_node_locks[index].lock;
> +}
> +
> +static inline struct mutex *open_file_mutex_ptr(struct kernfs_node *kn)
> +{
> +	int index = hash_ptr(kn, NR_KERNFS_LOCK_BITS);
> +
> +	return &kernfs_global_locks.open_file_mutex[index].lock;
> +}

I wonder whether it'd be useful to provide some helpers so that users don't
have to get the pointer for the lock and then lock it in separate steps.
Would it make sense to provide something which locks and returns the pointer
(or token)?

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ