lll_futex_wake_unlock customized on sparc -- why?

Torvald Riegel triegel@redhat.com
Wed Dec 17 23:45:00 GMT 2014


Dave, do you know why sparc lowlevellock.h avoids FUTEX_WAKE_OP (see
code snippet below)?  The only client of this function seems to be in
nptl/pthread_cond_signal.c, which falls back to normal FUTEX_WAKE due to
this change.

Is this customization essential, or just bit-rot?  Except this change,
sparc lowlevellock.h seems to have standard futex operations; it would
be nice if we could use the generic lowlevellock-futex.h on sparc too.

Thanks.


/* Returns non-zero if error happened, zero if success.  */
#ifdef __sparc32_atomic_do_lock
/* Avoid FUTEX_WAKE_OP if supporting pre-v9 CPUs.  */
# define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2, private) 1
#else
# define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2, private) \
  ({									      \
    INTERNAL_SYSCALL_DECL (__err);					      \
    long int __ret;							      \
									      \
    __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp),		      \
			      __lll_private_flag (FUTEX_WAKE_OP, private),    \
			      (nr_wake), (nr_wake2), (futexp2),		      \
			      FUTEX_OP_CLEAR_WAKE_IF_GT_ONE);		      \
    INTERNAL_SYSCALL_ERROR_P (__ret, __err);				      \
  })
#endif





More information about the Libc-alpha mailing list