Module Name:    src
Committed By:   riastradh
Date:           Wed Jun 16 21:53:51 UTC 2021

Modified Files:
        src/libexec/ld.elf_so: rtld.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.208 -r1.209 src/libexec/ld.elf_so/rtld.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.208 src/libexec/ld.elf_so/rtld.c:1.209
--- src/libexec/ld.elf_so/rtld.c:1.208	Sun May 30 02:26:08 2021
+++ src/libexec/ld.elf_so/rtld.c	Wed Jun 16 21:53:51 2021
@@ -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 @@ _rtld_shared_enter(void)
 	unsigned int cur;
 	lwpid_t waiter, self = 0;
 
-	membar_enter();
-
 	for (;;) {
 		cur = _rtld_mutex;
 		/*

Reply via email to