From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] SINGLE_THREAD_P in ld.so
Date: Fri, 27 Oct 2006 08:29:00 -0000 [thread overview]
Message-ID: <20061027082937.GO5868@sunsite.mff.cuni.cz> (raw)
Hi!
When trying to optimize the {_dl_{,profile_}fixup,dl{,v}sym} vs.
dlopen/dlclose locking, I missed the fact that SINGLE_THREAD_P is
unconditionally defined to 1 in ld.so. The result is that al the
__rtld_mrlock_* stuff is ATM optimized out in ld.so.
This patch fixes that.
2006-10-27 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (SINGLE_THREAD_P):
Define to THREAD_SELF->header.multiple_threads.
* sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (SINGLE_THREAD_P):
Likewise.
* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (SINGLE_THREAD_P):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
(SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
(SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
(SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
(SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (SINGLE_THREAD_P):
Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h
(SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h
(SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (SINGLE_THREAD_P):
Likewise.
--- libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h.jj 2004-09-06 03:12:02.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h 2006-10-24 10:22:00.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -163,7 +163,13 @@ extern int __local_multiple_threads attr
#else
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+# define SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+# else
+# define SINGLE_THREAD_P (1)
+# endif
# define NO_CANCELLATION 1
#endif
--- libc/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h.jj 2004-07-06 06:25:45.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h 2006-10-24 10:22:11.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
@@ -216,7 +216,13 @@ __GC_##name: \
#elif !defined __ASSEMBLER__
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+# define SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+# else
+# define SINGLE_THREAD_P (1)
+# endif
# define NO_CANCELLATION 1
#endif
--- libc/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h.jj 2006-10-17 11:21:51.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h 2006-10-24 10:22:11.000000000 +0200
@@ -143,7 +143,13 @@
#elif !defined __ASSEMBLER__
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+# define SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+# else
+# define SINGLE_THREAD_P (1)
+# endif
# define NO_CANCELLATION 1
#endif
--- libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h.jj 2004-07-06 06:25:44.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h 2006-10-24 10:22:00.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -109,7 +109,13 @@ L(pseudo_end):
#elif !defined __ASSEMBLER__
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+# define SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+# else
+# define SINGLE_THREAD_P (1)
+# endif
# define NO_CANCELLATION 1
#endif
--- libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h.jj 2004-07-06 06:25:44.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h 2006-10-24 10:22:00.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -122,7 +122,13 @@ extern int __local_multiple_threads attr
#elif !defined __ASSEMBLER__
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+# define SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+# else
+# define SINGLE_THREAD_P (1)
+# endif
# define NO_CANCELLATION 1
#endif
--- libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h.jj 2006-01-04 21:03:07.000000000 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h 2006-10-24 10:22:00.000000000 +0200
@@ -113,7 +113,13 @@
#elif !defined __ASSEMBLER__
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+# define SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+# else
+# define SINGLE_THREAD_P (1)
+# endif
# define NO_CANCELLATION 1
#endif
--- libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h.jj 2006-01-04 21:03:07.000000000 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h 2006-10-24 10:22:00.000000000 +0200
@@ -124,7 +124,13 @@
#elif !defined __ASSEMBLER__
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+# define SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+# else
+# define SINGLE_THREAD_P (1)
+# endif
# define NO_CANCELLATION 1
#endif
--- libc/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h.jj 2005-03-31 12:00:15.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h 2006-10-24 10:22:11.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
@@ -132,7 +132,13 @@ extern int __local_multiple_threads attr
#elif !defined __ASSEMBLER__
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+# define SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+# else
+# define SINGLE_THREAD_P (1)
+# endif
# define NO_CANCELLATION 1
#endif
--- libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h.jj 2006-03-06 02:34:01.000000000 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h 2006-10-24 10:22:00.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
@@ -100,7 +100,13 @@ __##syscall_name##_nocancel: \
#elif !defined __ASSEMBLER__
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+# define SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+# else
+# define SINGLE_THREAD_P (1)
+# endif
# define NO_CANCELLATION 1
#endif
--- libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h.jj 2006-03-06 02:34:01.000000000 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h 2006-10-24 10:22:00.000000000 +0200
@@ -98,7 +98,13 @@ __##syscall_name##_nocancel: \
#elif !defined __ASSEMBLER__
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+# define SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+# else
+# define SINGLE_THREAD_P (1)
+# endif
# define NO_CANCELLATION 1
#endif
--- libc/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h.jj 2005-12-30 23:18:03.000000000 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h 2006-10-24 10:22:00.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -157,7 +157,13 @@
#elif !defined __ASSEMBLER__
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+# define SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+# else
+# define SINGLE_THREAD_P (1)
+# endif
# define NO_CANCELLATION 1
#endif
Jakub
reply other threads:[~2006-10-27 8:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061027082937.GO5868@sunsite.mff.cuni.cz \
--to=jakub@redhat.com \
--cc=drepper@redhat.com \
--cc=libc-hacker@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).