Re: [RFC] NUMA futex hashing

Ulrich Drepper
2006-08-08T14:40:03Z

On 8/8/06, Eric Dumazet <dada1@cosmosbay.com> wrote:
> The validity of the virtual address is still tested by normal get_user()
> call.. If the memory was freed by a thread, then a normal EFAULT error will
> be reported... eventually.

This is indeed what should be done. Private futexes are the by far
more frequent case and I bet you'd see improvements when avoiding the
mm mutex even for normal machines since futexes really are everywhere.
For shared mutexes you end up doing two lookups and that's fine IMO
as long as the first lookup is fast.

As for the NUMA case, I would oppose any change which has the
slightest impact on non-NUMA machines. It cannot be allowed that the
majority of systems is slowed down significantly just because of NUMA.
Especially since the effects of NUMA beside cache line transfer
penalties IMO probably are neglect able. The in-kernel futex
representation only exists when there are waiters and so the memory
needed is only allocated when we a waiting. In this case it just be
easy enough to use local memory. But this unlikely will help much
since the waker thread is ideally not on the same processor, maybe not
even on the same node. So there will be cacheline transfers in most
cases and everything possible improvement will be minimal and maybe
even not generally measurable.

If you want to do anything in this area, first remove the global
mutex. Then really measure with real world application. And I don't
mean specially designed HPC apps which assign threads/processes to
processors or nodes. Those are special cases of a special case.