[PATCH] Clean up BUSY_WAIT_NOP and atomic_delay.
Torvald Riegel
triegel@redhat.com
Tue Jun 23 15:14:00 GMT 2015
This patch combines BUSY_WAIT_NOP and atomic_delay into a new
atomic_spin_nop function and adjusts all clients. The new function is
put into atomic.h because what is best done in a spin loop is
architecture-specific, and atomics must be used for spinning. The
function name is meant to tell users that this has no effect on
synchronization semantics but is a performance aid for spinning.
Roland, this removes the NaCl definitions of spinning because they
should be primarily architecture-dependent. I don't know whether you're
doing something really advanced with spinning yet that would be NaCl
specific, but then this would be future work anyway and would likely
involve a custom implementation of a whole spin loop and the
accompanying futex wait call. If so, we can address this later.
Dave, can you check the sparc bits please? I believe I just moved code
around, but I can't test this easily.
Tested on x86_64-linux.
2015-06-23 Torvald Riegel <triegel@redhat.com>
* sysdeps/unix/sysv/linux/i386/lowlevellock.h (BUSY_WAIT_NOP): Remove.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (BUSY_WAIT_NOP):
Likewise.
* sysdeps/i386/i486/bits/atomic.h (atomic_delay): Rename to
atomic_spin_nop.
* sysdeps/x86_64/bits/atomic.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h (BUSY_WAIT_NOP): Rename
to atomic_spin_nop and move ...
* sysdeps/sparc/sparc32/sparcv9/bits/atomic.h (atomic_spin_nop):
... here and ...
* sysdeps/sparc/sparc64/bits/atomic.h: ... here.
* nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Use
atomic_spin_nop instead of BUSY_WAIT_NOP.
* nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock):
Likewise.
* sysdeps/nacl/lll_timedwait_tid.c (__lll_timedwait_tid): Likewise.
* sysdeps/nacl/lowlevellock.h (BUSY_WAIT_NOP): Remove.
(lll_wait_tid): Use atomic_spin_nop instead of BUSY_WAIT_NOP.
* nscd/nscd-client.h (__nscd_acquire_maplock): Use atomic_spin_nop
instead of atomic_delay.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atomic-spin.patch
Type: text/x-patch
Size: 7414 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150623/119f754c/attachment.bin>
More information about the Libc-alpha
mailing list