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

From: Thomas Gleixner

Date: Tue Aug 25 2026 - 12:48:58 EST


On Fri, Aug 21 2026 at 15:18, Thomas Gleixner wrote:
> On Thu, Aug 20 2026 at 16:14, Dmitry Ilvokhin wrote:
> There is no magic cure for this with the current implementations and I
> doubt that any benchmark will give a satisfying answer which is
> generally useful accross a wider range of application scenarios.
>
> This needs quite some thought and investigations to get right.

I looked a bit deeper into it. When the number of contenders is big
enough to cause a massive cache line bouncing issue on the futex
variable then the lock contention on hb lock helps to prevent it from
becoming worse. It basically ensures that enough waiters are stuck in
the kernel that the rest of the threads can make progress, even if they
right away after acquiring the hash bucket lock.

Works by chance but certainly not by design :)