Re: futex2 numa stuff

From: Davidlohr Bueso
Date: Thu Sep 28 2023 - 09:41:10 EST


On Fri, 22 Sep 2023, Peter Zijlstra wrote:

Hi!

Updated version of patch 15/15 and a few extra patches for testing the
FUTEX2_NUMA bits. The last patch (17/15) should never be applied for anything
you care about and exists purely because I'm too lazy to generate actual
hash-bucket contention.

On my 2 node IVB-EP:

$ echo FUTEX_SQUASH > /debug/sched/features

Effectively reducing each node to 1 bucket.

$ numactl -m0 -N0 ./futex_numa -c10 -t2 -n0 -N0 &
numactl -m1 -N1 ./futex_numa -c10 -t2 -n0 -N0

...
contenders: 16154935
contenders: 16202472

$ numactl -m0 -N0 ./futex_numa -c10 -t2 -n0 -N0 &
numactl -m1 -N1 ./futex_numa -c10 -t2 -n0 -N1

contenders: 48584991
contenders: 48680560

(loop counts, higher is better)

Clearly showing how separating the hashes works.

The first one runs 10 contenders on each node but forces the (numa) futex to
hash to node 0 for both. This ensures all 20 contenders hash to the same
bucket and *ouch*.

The second one does the same, except now fully separates the nodes. Performance
is much improved.

Proving the per-node hashing actually works as advertised.

Very nice.