Re: [PATCH v4 07/11] futex: Allow to make the number of slots invariant.

Sebastian Andrzej Siewior
2024-12-06T08:19:04Z

On 2024-12-03 17:42:15 [+0100], To linux-kernel@vger.kernel.org wrote:
> diff --git a/kernel/futex/core.c b/kernel/futex/core.c
> index 0dd7100e36419..1abea8f9abd22 100644
> --- a/kernel/futex/core.c
> +++ b/kernel/futex/core.c
> @@ -1323,6 +1335,36 @@ static int futex_hash_get_slots(void)
…
> +bool futex_hash_is_invariant(void)
> +{
> + struct futex_hash_bucket_private *hb_p;
> + struct mm_struct *mm;
> +
> + mm = current->mm;
> + guard(rcu)();
> + hb_p = rcu_dereference(mm->futex_hash_bucket);
> + if (!hb_p)
> + return -EINVAL;

Dan spotted that this should be false.

> + return hb_p->slots_invariant;
> +}

Sebastian