nptl: Remove private futex optimization [BZ #27304]

Message ID 87k0rstbtc.fsf@oldenburg.str.redhat.com
State Committed
Commit c4ad832276f4dadfa40904109b26a521468f66bc
Headers
Series nptl: Remove private futex optimization [BZ #27304] |

Commit Message

Florian Weimer Feb. 1, 2021, 8:46 a.m. UTC
  It is effectively used, except for pthread_cond_destroy, where we do
not want it; see bug 27304.  The internal locks do not support a
process-shared mode.

This fixes commit dc6cfdc934db9997c33728082d63552b9eee4563 ("nptl:
Move pthread_cond_destroy implementation into libc").

Tested on i686-linux-gnu and x86_64-linux-gnu.  This is for glib 2.34,
although I intend to backport it to 2.32 and 2.33 because it looks like
it might be a regression.

---
 sysdeps/nptl/lowlevellock-futex.h | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
  

Comments

Andreas Schwab Feb. 1, 2021, 9:24 a.m. UTC | #1
On Feb 01 2021, Florian Weimer via Libc-alpha wrote:

> It is effectively used,

unused?

Andreas.
  
Florian Weimer Feb. 1, 2021, 9:25 a.m. UTC | #2
* Andreas Schwab:

> On Feb 01 2021, Florian Weimer via Libc-alpha wrote:
>
>> It is effectively used,
>
> unused?

Right, fixed.  Thanks.

Florian
  
Adhemerval Zanella Netto Feb. 3, 2021, 8:10 p.m. UTC | #3
On 01/02/2021 05:46, Florian Weimer via Libc-alpha wrote:
> It is effectively used, except for pthread_cond_destroy, where we do
> not want it; see bug 27304.  The internal locks do not support a
> process-shared mode.
> 
> This fixes commit dc6cfdc934db9997c33728082d63552b9eee4563 ("nptl:
> Move pthread_cond_destroy implementation into libc").
> 
> Tested on i686-linux-gnu and x86_64-linux-gnu.  This is for glib 2.34,
> although I intend to backport it to 2.32 and 2.33 because it looks like
> it might be a regression.

The lll_futex_wake is used on THREAD_GSCOPE_RESET_FLAG, but it already
uses LLL_PRIVATE on all architectures. 

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> 
> ---
>  sysdeps/nptl/lowlevellock-futex.h | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/sysdeps/nptl/lowlevellock-futex.h b/sysdeps/nptl/lowlevellock-futex.h
> index ecb729da6b..ca96397a4a 100644
> --- a/sysdeps/nptl/lowlevellock-futex.h
> +++ b/sysdeps/nptl/lowlevellock-futex.h
> @@ -50,20 +50,8 @@
>  #define LLL_SHARED	FUTEX_PRIVATE_FLAG
>  
>  #ifndef __ASSEMBLER__
> -
> -# if IS_IN (libc) || IS_IN (rtld)
> -/* In libc.so or ld.so all futexes are private.  */
> -#  define __lll_private_flag(fl, private)			\
> -  ({								\
> -    /* Prevent warnings in callers of this macro.  */		\
> -    int __lll_private_flag_priv __attribute__ ((unused));	\
> -    __lll_private_flag_priv = (private);			\
> -    ((fl) | FUTEX_PRIVATE_FLAG);				\
> -  })
> -# else
> -#  define __lll_private_flag(fl, private) \
> +# define __lll_private_flag(fl, private) \
>    (((fl) | FUTEX_PRIVATE_FLAG) ^ (private))
> -# endif
>  
>  # define lll_futex_syscall(nargs, futexp, op, ...)                      \
>    ({                                                                    \
>
  

Patch

diff --git a/sysdeps/nptl/lowlevellock-futex.h b/sysdeps/nptl/lowlevellock-futex.h
index ecb729da6b..ca96397a4a 100644
--- a/sysdeps/nptl/lowlevellock-futex.h
+++ b/sysdeps/nptl/lowlevellock-futex.h
@@ -50,20 +50,8 @@ 
 #define LLL_SHARED	FUTEX_PRIVATE_FLAG
 
 #ifndef __ASSEMBLER__
-
-# if IS_IN (libc) || IS_IN (rtld)
-/* In libc.so or ld.so all futexes are private.  */
-#  define __lll_private_flag(fl, private)			\
-  ({								\
-    /* Prevent warnings in callers of this macro.  */		\
-    int __lll_private_flag_priv __attribute__ ((unused));	\
-    __lll_private_flag_priv = (private);			\
-    ((fl) | FUTEX_PRIVATE_FLAG);				\
-  })
-# else
-#  define __lll_private_flag(fl, private) \
+# define __lll_private_flag(fl, private) \
   (((fl) | FUTEX_PRIVATE_FLAG) ^ (private))
-# endif
 
 # define lll_futex_syscall(nargs, futexp, op, ...)                      \
   ({                                                                    \