[PATCH v3] nptl: Move elision implementations into libc

Andreas Schwab schwab@linux-m68k.org
Tue Feb 23 12:37:06 GMT 2021


On Feb 23 2021, Florian Weimer via Libc-alpha wrote:

> diff --git a/sysdeps/nptl/lowlevellock.h b/sysdeps/nptl/lowlevellock.h
> index 176ba96251..c1a6617308 100644
> --- a/sysdeps/nptl/lowlevellock.h
> +++ b/sysdeps/nptl/lowlevellock.h
> @@ -20,6 +20,7 @@
>  #define _LOWLEVELLOCK_H	1
>  
>  #include <atomic.h>
> +#include <elision-conf.h>
>  #include <lowlevellock-futex.h>
>  #include <time.h>
>  
> @@ -160,4 +161,107 @@ libc_hidden_proto (__lll_lock_wait)
>  #define LLL_LOCK_INITIALIZER		(0)
>  #define LLL_LOCK_INITIALIZER_LOCKED	(1)
>  
> +/* Elision support.  */
> +
> +#if ENABLE_ELISION_SUPPORT
> +/* Force elision for all new locks.  This is used to decide whether
> +   existing DEFAULT locks should be automatically upgraded to elision
> +   in pthread_mutex_lock.  Disabled for suid programs.  Only used when
> +   elision is available.  */
> +extern int __pthread_force_elision;
> +libc_hidden_proto (__pthread_force_elision)
> +#endif

That can be merged with the conditional block below.

> +#if ENABLE_ELISION_SUPPORT
> +# define lll_clocklock_elision(futex, adapt_count, clockid, timeout, private) \
> +  __lll_clocklock_elision (&(futex), &(adapt_count), clockid, timeout, private)
> +# define lll_lock_elision(futex, adapt_count, private) \
> +  __lll_lock_elision (&(futex), &(adapt_count), private)
> +# define lll_trylock_elision(futex, adapt_count) \
> +  __lll_trylock_elision (&(futex), &(adapt_count))
> +# if ELISION_UNLOCK_NEEDS_ADAPT_COUNT
> +#  define lll_unlock_elision(futex, adapt_count, private) \
> +  __lll_unlock_elision (&(futex), &(adapt_count), private)
> +#else
> +#  define lll_unlock_elision(futex, adapt_count, private) \
> +  __lll_unlock_elision (&(futex), private)
> +#endif

Missing indentation.

> +#else /* !ENABLE_ELISION_SUPPORT */
> +
> +#define lll_clocklock_elision(futex, adapt_count, clockid, abstime, private) \

Missing indentation.

Ok with that changes.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


More information about the Libc-alpha mailing list