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: <87frn1qhza.ffs@tglx>
Date: Fri, 06 Dec 2024 10:27:21 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
 linux-kernel@...r.kernel.org
Cc: André Almeida <andrealmeid@...lia.com>, Darren Hart
 <dvhart@...radead.org>, Davidlohr Bueso <dave@...olabs.net>, Ingo Molnar
 <mingo@...hat.com>, Juri Lelli <juri.lelli@...hat.com>, Peter Zijlstra
 <peterz@...radead.org>, Valentin Schneider <vschneid@...hat.com>, Waiman
 Long <longman@...hat.com>, Sebastian Andrzej Siewior
 <bigeasy@...utronix.de>
Subject: Re: [PATCH v4 08/11] futex: Resize futex hash table based on number
 of threads.

On Tue, Dec 03 2024 at 17:42, Sebastian Andrzej Siewior wrote:
>  int futex_hash_allocate_default(void)
>  {
> -	return futex_hash_allocate(0);
> +	unsigned int threads;
> +	unsigned int buckets;
> +	unsigned int current_buckets = 0;
> +	struct futex_hash_bucket_private *hb_p;

https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#variable-declarations

> +
> +	if (!current->mm)
> +		return 0;
> +
> +	scoped_guard(rcu) {
> +		threads = get_nr_threads(current);
> +		hb_p = rcu_dereference(current->mm->futex_hash_bucket);
> +		if (hb_p) {
> +			if (hb_p->slots_invariant)
> +				return 0;
> +			current_buckets = hb_p->hash_mask + 1;
> +		}
> +	}
> +
> +	buckets = roundup_pow_of_two(4 * threads);
> +	buckets = max(buckets, 16);
> +	buckets = min(buckets, futex_default_max_buckets);
> +	if (current_buckets > buckets)

  >= ?

Thanks,

        tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ