libio: Improve performance of IO locks
commitc51c483d2b8ae66fe31a12509aedae02a6982ced
authorWilco Dijkstra <wdijkstr@arm.com>
Thu, 11 Aug 2022 15:47:45 +0000 (11 16:47 +0100)
committerWilco Dijkstra <wdijkstr@arm.com>
Thu, 11 Aug 2022 15:47:45 +0000 (11 16:47 +0100)
treec1da76a910cc6e015843c24b495c987237de916d
parent11f09947f3066f5ff84fd15ef22b72b46eea97a8
libio: Improve performance of IO locks

Improve performance of recursive IO locks by adding a fast path for
the single-threaded case. To reduce the number of memory accesses for
locking/unlocking, only increment the recursion counter if the lock
is already taken.

On Neoverse V1, a microbenchmark with many small freads improved by
2.9x. Multithreaded performance improved by 2%.

Reviewed-by: Cristian Rodríguez <crrodriguez@opensuse.org>
sysdeps/nptl/stdio-lock.h