+2015-06-30 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.
+
2015-06-29 Joseph Myers <joseph@codesourcery.com>
[BZ #18613]
#endif /* !USE_ATOMIC_COMPILER_BUILTINS */
-
-#ifndef atomic_delay
-# define atomic_delay() do { /* nothing */ } while (0)
+/* This operation does not affect synchronization semantics but can be used
+ in the body of a spin loop to potentially improve its efficiency. */
+#ifndef atomic_spin_nop
+# define atomic_spin_nop() do { /* nothing */ } while (0)
#endif
#endif /* atomic.h */
#include <sys/param.h>
#include <not-cancel.h>
#include "pthreadP.h"
+#include <atomic.h>
#include <lowlevellock.h>
#include <stap-probe.h>
LLL_MUTEX_LOCK (mutex);
break;
}
-
-#ifdef BUSY_WAIT_NOP
- BUSY_WAIT_NOP;
-#endif
+ atomic_spin_nop ();
}
while (LLL_MUTEX_TRYLOCK (mutex) != 0);
#include <sys/param.h>
#include <sys/time.h>
#include "pthreadP.h"
+#include <atomic.h>
#include <lowlevellock.h>
#include <not-cancel.h>
PTHREAD_MUTEX_PSHARED (mutex));
break;
}
-
-#ifdef BUSY_WAIT_NOP
- BUSY_WAIT_NOP;
-#endif
+ atomic_spin_nop ();
}
while (lll_trylock (mutex->__data.__lock) != 0);
if (__glibc_unlikely (++cnt > 5))
return false;
- atomic_delay ();
+ atomic_spin_nop ();
}
return true;
__result; })
-#define atomic_delay() asm ("rep; nop")
+#define atomic_spin_nop() asm ("rep; nop")
#define __arch_and_body(lock, mem, mask) \
finish quick enough that the timeout doesn't matter. If any
thread ever stays in this state for long, there is something
catastrophically wrong. */
- BUSY_WAIT_NOP;
+ atomic_spin_nop ();
else
{
assert (tid > 0);
/* Everything except the exit handling is the same as the generic code. */
# include <sysdeps/nptl/lowlevellock.h>
-# ifndef BUSY_WAIT_NOP
-# define BUSY_WAIT_NOP __sync_synchronize ()
-# endif
-
/* See exit-thread.h for details. */
# define NACL_EXITING_TID 1
while ((__tid = atomic_load_relaxed (__tidp)) != 0) \
{ \
if (__tid == NACL_EXITING_TID) \
- BUSY_WAIT_NOP; \
+ atomic_spin_nop (); \
else \
lll_futex_wait (__tidp, __tid, LLL_PRIVATE); \
} \
__asm __volatile ("membar #LoadLoad | #LoadStore" : : : "memory")
#define atomic_write_barrier() \
__asm __volatile ("membar #LoadStore | #StoreStore" : : : "memory")
+
+extern void __cpu_relax (void);
+#define atomic_spin_nop () __cpu_relax ()
__asm __volatile ("membar #LoadLoad | #LoadStore" : : : "memory")
#define atomic_write_barrier() \
__asm __volatile ("membar #LoadStore | #StoreStore" : : : "memory")
+
+extern void __cpu_relax (void);
+#define atomic_spin_nop () __cpu_relax ()
#define LLL_LOCK_INITIALIZER_WAITERS (2)
-/* Delay in spinlock loop. */
-#define BUSY_WAIT_NOP asm ("rep; nop")
-
-
/* NB: in the lll_trylock macro we simply return the value in %eax
after the cmpxchg instruction. In case the operation succeded this
value is zero. In case the operation failed, the cmpxchg instruction
#include <atomic.h>
#include <kernel-features.h>
-#ifndef __sparc32_atomic_do_lock
-/* Delay in spinlock loop. */
-extern void __cpu_relax (void);
-#define BUSY_WAIT_NOP __cpu_relax ()
-#endif
-
#include <lowlevellock-futex.h>
static inline int
#define LLL_LOCK_INITIALIZER_LOCKED (1)
#define LLL_LOCK_INITIALIZER_WAITERS (2)
-/* Delay in spinlock loop. */
-#define BUSY_WAIT_NOP asm ("rep; nop")
-
/* NB: in the lll_trylock macro we simply return the value in %eax
after the cmpxchg instruction. In case the operation succeded this
__result; })
-#define atomic_delay() asm ("rep; nop")
+#define atomic_spin_nop() asm ("rep; nop")
#define __arch_and_body(lock, mem, mask) \