selftests/futex: Add futex_priv_hash
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 16 Apr 2025 16:29:20 +0000 (18:29 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Sat, 3 May 2025 10:02:10 +0000 (12:02 +0200)
commitcda95faef7bcf26ba3f54c3cddce66d50116d146
tree64e94bbb2932c624523eae8c7ed08af4f9980d40
parent8b4a5c2497fad653bc54ddb037d38eb5bf835857
selftests/futex: Add futex_priv_hash

Test the basic functionality of the private hash:
- Upon start, with no threads there is no private hash.
- The first thread initializes the private hash.
- More than four threads will increase the size of the private hash if
  the system has more than 16 CPUs online.
- Once the user sets the size of private hash, auto scaling is disabled.
- The user is only allowed to use numbers to the power of two.
- The user may request the global or make the hash immutable.
- Once the global hash has been set or the hash has been made immutable,
  further changes are not allowed.
- Futex operations should work the whole time. It must be possible to
  hold a lock, such a PI initialised mutex, during the resize operation.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250416162921.513656-21-bigeasy@linutronix.de
tools/testing/selftests/futex/functional/.gitignore
tools/testing/selftests/futex/functional/Makefile
tools/testing/selftests/futex/functional/futex_priv_hash.c [new file with mode: 0644]
tools/testing/selftests/futex/functional/run.sh