Re: [PATCH v10 00/21] futex: Add support task local hash maps, FUTEX2_NUMA and FUTEX2_MPOL
From: Peter Zijlstra
Date: Fri Mar 14 2025 - 06:43:11 EST
On Wed, Mar 12, 2025 at 04:18:48PM +0100, Sebastian Andrzej Siewior wrote:
> @@ -196,12 +196,12 @@ static bool __futex_pivot_hash(struct mm_struct *mm,
> {
> struct futex_private_hash *fph;
>
> - lockdep_assert_held(&mm->futex_hash_lock);
> WARN_ON_ONCE(mm->futex_phash_new);
>
> - fph = mm->futex_phash;
> + fph = rcu_dereference_protected(mm->futex_phash,
> + lockdep_is_held(&mm->futex_hash_lock));
I are confused... this makes no sense. Why ?!
We only ever write that variable while holding this lock, we hold the
lock, we don't need RCU to read the variable.