Re: [PATCH] futex: Avoid hash-bucket locking for mismatched waits

From: Thomas Gleixner

Date: Sat Aug 08 2026 - 05:19:35 EST


On Fri, Jul 31 2026 at 12:26, Usama Arif wrote:
>
> + /*
> + * A mismatch here refuses the wait without locating the hash bucket;
> + * a match is rechecked under the lock below before queueing.
> + *
> + * get_futex_key() runs get_user_pages_fast() only for shared futexes,
> + * so their page is resident and the non-faulting read suffices, with
> + * the locked path recovering if it does not. A private futex may

That's a fairy tale:

get_futex_key()
...
// shared
get_user_pages_fast(); // gets a page reference
...
folio = page_folio(page);
...

out:
folio_put(folio); // drops the page reference

Thanks,

tglx