Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ld.elf_so ld.elf_so(1): Omit needless membar_enter.



details:   https://anonhg.NetBSD.org/src/rev/531283bbb75f
branches:  trunk
changeset: 1021769:531283bbb75f
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Jun 16 21:53:51 2021 +0000

description:
ld.elf_so(1): Omit needless membar_enter.

The use of membar_enter is to separate atomic r/m/w on a lock from
the body of the critical section so two different critical sections
happen in order:

                body of previous critical section;

        exit critical section:
                membar_exit();
                atomic_r/m/w(lock stuff);

        enter critical section:
                atomic_r/m/w(lock stuff);
                membar_enter();

                body of next critical section;

_rtld_shared_enter does this, but it _also_ issued an extraneous
membar_enter before the atomic_r/m/w part, which doesn't impose any
semantically important order but may cost some performance.

diffstat:

 libexec/ld.elf_so/rtld.c |  6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diffs (27 lines):

diff -r ad29b28fe322 -r 531283bbb75f libexec/ld.elf_so/rtld.c
--- a/libexec/ld.elf_so/rtld.c  Wed Jun 16 19:31:03 2021 +0000
+++ b/libexec/ld.elf_so/rtld.c  Wed Jun 16 21:53:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtld.c,v 1.208 2021/05/30 02:26:08 joerg Exp $  */
+/*     $NetBSD: rtld.c,v 1.209 2021/06/16 21:53:51 riastradh Exp $      */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.208 2021/05/30 02:26:08 joerg Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.209 2021/06/16 21:53:51 riastradh Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -1673,8 +1673,6 @@
        unsigned int cur;
        lwpid_t waiter, self = 0;
 
-       membar_enter();
-
        for (;;) {
                cur = _rtld_mutex;
                /*



Home | Main Index | Thread Index | Old Index