[PATCH] benchtests: Add libc locking benchmark

Wilco Dijkstra Wilco.Dijkstra@arm.com
Thu Aug 18 18:56:26 GMT 2022


Hi Carlos,

> You are using rand as a proxy for __libc_lock_lock() performance.
>
> Given that we build the benchtests/ within the same framework, can
> we access glibc internals and try to benchmark the locks directly?
>
> Just like we have some tests using internals? If it doesn't work
> out easily, then I think the current direction is fine.

I don't believe there are tests for locking internals - the only tests that exist
are the basic atomics and the pthread tests. Trying to include the locking
headers resulted in lots of errors. The benchmarks are dynamically linked,
so you can only test exported interfaces. I think we'd need to add extra
exported (but not officially supported) functions if we want to benchmark
internal locks directly.

Alternatively we could create a benchmark of standard lock implementations
and run them in various scenarios. This could then be used to answer questions
like whether we should prefer exchange or compare-exchange, whether locks
should always spin for a short while (pthread locks do but internal locks don't)
and further improve the internal locks.

Cheers,
Wilco


More information about the Libc-alpha mailing list