summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-07-09 10:59:22 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-07-09 10:59:22 +0200
commit508ee037a30f1d4f6a1f8de2bd0d9866d4684625 (patch)
tree7784739365084bd7bef3913e01e58f31b7599ad5 /nptl
parent01d780628278972cfa3630feeb74d7861b0fd5fc (diff)
downloadglibc-508ee037a30f1d4f6a1f8de2bd0d9866d4684625.tar.gz
glibc-508ee037a30f1d4f6a1f8de2bd0d9866d4684625.tar.xz
glibc-508ee037a30f1d4f6a1f8de2bd0d9866d4684625.zip
nptl: Use out-of-line wake function in __libc_lock_unlock slow path
This slightly reduces code size, as can be seen below.
__libc_lock_unlock is usually used along with __libc_lock_lock in
the same function.  __libc_lock_lock already has an out-of-line
slow path, so this change should not introduce many additional
non-leaf functions.

This change also fixes a link failure in 32-bit Arm thumb mode
because commit 1f9c804fbd699104adefbce9e56d2c8aa711b6b9
("nptl: Use internal low-level lock type for !IS_IN (libc)")
introduced __libc_do_syscall calls outside of libc.

Before x86-64:

   text	   data	    bss	    dec	    hex	filename
1937748	  20456	  54896	2013100	 1eb7ac	libc.so.6
  25601	    856	  12768	  39225	   9939	nss/libnss_db.so.2
  40310	    952	  25144	  66406	  10366	nss/libnss_files.so.2

After x86-64:
   text	   data	    bss	    dec	    hex	filename
1935312	  20456	  54896	2010664	 1eae28	libc.so.6
  25559	    864	  12768	  39191	   9917	nss/libnss_db.so.2
  39764	    960	  25144	  65868	  1014c	nss/libnss_files.so.2

Before i686:

2110961	  11272	  39144	2161377	 20fae1	libc.so.6
  27243	    428	  12652	  40323	   9d83	nss/libnss_db.so.2
  43062	    476	  25028	  68566	  10bd6	nss/libnss_files.so.2

After i686:

2107347	  11272	  39144	2157763	 20ecc3	libc.so.6
  26929	    432	  12652	  40013	   9c4d	nss/libnss_db.so.2
  43132	    480	  25028	  68640	  10c20	nss/libnss_files.so.2

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'nptl')
-rw-r--r--nptl/Versions1
-rw-r--r--nptl/lowlevellock.c14
2 files changed, 15 insertions, 0 deletions
diff --git a/nptl/Versions b/nptl/Versions
index 2a75f013f2..3221de89d1 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -380,6 +380,7 @@ libc {
   }
   GLIBC_PRIVATE {
     __libc_alloca_cutoff;
+    __lll_lock_wake_private;
     __lll_lock_wait_private;
     __nptl_create_event;
     __nptl_death_event;
diff --git a/nptl/lowlevellock.c b/nptl/lowlevellock.c
index 2d077d8694..4f88178964 100644
--- a/nptl/lowlevellock.c
+++ b/nptl/lowlevellock.c
@@ -52,6 +52,20 @@ __lll_lock_wait (int *futex, int private)
 }
 libc_hidden_def (__lll_lock_wait)
 
+void
+__lll_lock_wake_private (int *futex)
+{
+  lll_futex_wake (futex, 1, LLL_PRIVATE);
+}
+libc_hidden_def (__lll_lock_wake_private)
+
+void
+__lll_lock_wake (int *futex, int private)
+{
+  lll_futex_wake (futex, 1, private);
+}
+libc_hidden_def (__lll_lock_wake)
+
 #if ENABLE_ELISION_SUPPORT
 int __pthread_force_elision __attribute__ ((nocommon));
 libc_hidden_data_def (__pthread_force_elision)