[PATCH][AArch64] Single thread lowlevellock optimization
Szabolcs Nagy
szabolcs.nagy@arm.com
Fri Jun 16 16:26:00 GMT 2017
Do single thread lock optimization in aarch64 libc. Atomic operations
hurt the performance of some single-threaded programs using stdio
(usually getc/putc in a loop).
Ideally such optimization should be done at a higher level and in a
target independent way as in
https://sourceware.org/ml/libc-alpha/2017-05/msg00479.html
but that approach will need more discussion so do it in lowlevellocks,
similarly to x86, until there is consensus.
Differences compared to the current x86_64 behaviour:
- The optimization is not silently applied to shared locks, in that
case the build fails.
- Unlock assumes the futex value is 0 or 1, there are no waiters to
wake (that would not work in single thread and libc does not use
such locks, to be sure lll_cond* is undefed).
This speeds up a getchar loop about 2-4x depending on the cpu,
while only cause around 5-10% regression for the multi-threaded case
(other libc internal locks are not expected to be performance
critical or significantly affected by this change).
2017-06-16 Szabolcs Nagy <szabolcs.nagy@arm.com>
* sysdeps/unix/sysv/linux/aarch64/lowlevellock.h: New file.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lll.diff
Type: text/x-patch
Size: 3231 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20170616/612be336/attachment.bin>
More information about the Libc-alpha
mailing list