Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1403711

Re: [patch V2 3/7] futex: Add op for hash preallocation

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [patch V2 3/7] futex: Add op for hash preallocation
Date 2016-05-19 14:30 +0200
Message-ID <rAvfs-8bz-37@gated-at.bofh.it> (permalink)
References <rvynE-79b-3@gated-at.bofh.it> <rvynE-79b-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, May 05, 2016 at 08:44:05PM -0000, Thomas Gleixner wrote:
> +static int futex_preallocate_hash(unsigned int slots)
> +{
> +#ifdef CONFIG_FUTEX_PRIVATE_HASH
> +	struct mm_struct *mm = current->mm;
> +	struct futex_hash_bucket *hb;
> +	unsigned int bits;
> +
> +	/* Try to allocate the requested nr of slots */
> +	bits = order_base_2(slots);
> +
> +	if (bits < FUTEX_MIN_HASH_BITS)
> +		bits = FUTEX_MIN_HASH_BITS;
> +
> +	if (bits > futex_max_hash_bits)
> +		bits = futex_max_hash_bits;
> +
> +	futex_populate_hash(bits);

Should we not simply fail if the provided number of slots is not a power
of 2 ?

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [patch V2 3/7] futex: Add op for hash preallocation Peter Zijlstra <peterz@infradead.org> - 2016-05-19 14:30 +0200
  Re: [patch V2 3/7] futex: Add op for hash preallocation Sebastian Andrzej Siewior <sebastian@breakpoint.cc> - 2016-05-27 19:30 +0200
    Re: [patch V2 3/7] futex: Add op for hash preallocation Peter Zijlstra <peterz@infradead.org> - 2016-05-30 11:00 +0200

csiph-web