Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern rwlock(9): Omit needless macro indirection for memb...
details: https://anonhg.NetBSD.org/src/rev/458c464df68c
branches: trunk
changeset: 373683:458c464df68c
user: riastradh <riastradh%NetBSD.org@localhost>
date: Fri Feb 24 11:11:10 2023 +0000
description:
rwlock(9): Omit needless macro indirection for membars.
No functional change intended.
diffstat:
sys/kern/kern_rwlock.c | 21 +++++++--------------
1 files changed, 7 insertions(+), 14 deletions(-)
diffs (77 lines):
diff -r bd17a01ad6e6 -r 458c464df68c sys/kern/kern_rwlock.c
--- a/sys/kern/kern_rwlock.c Fri Feb 24 11:03:13 2023 +0000
+++ b/sys/kern/kern_rwlock.c Fri Feb 24 11:11:10 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_rwlock.c,v 1.69 2023/02/24 11:02:27 riastradh Exp $ */
+/* $NetBSD: kern_rwlock.c,v 1.70 2023/02/24 11:11:10 riastradh Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007, 2008, 2009, 2019, 2020
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.69 2023/02/24 11:02:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.70 2023/02/24 11:11:10 riastradh Exp $");
#include "opt_lockdebug.h"
@@ -98,12 +98,6 @@
#endif /* DIAGNOSTIC */
/*
- * Memory barriers.
- */
-#define RW_MEMBAR_ACQUIRE() membar_acquire()
-#define RW_MEMBAR_RELEASE() membar_release()
-
-/*
* For platforms that do not provide stubs, or for the LOCKDEBUG case.
*/
#ifdef LOCKDEBUG
@@ -337,7 +331,7 @@
~RW_WRITE_WANTED);
if (__predict_true(next == owner)) {
/* Got it! */
- RW_MEMBAR_ACQUIRE();
+ membar_acquire();
break;
}
@@ -465,7 +459,7 @@
* proceed to do direct handoff if there are waiters, and if the
* lock would become unowned.
*/
- RW_MEMBAR_RELEASE();
+ membar_release();
for (;;) {
newown = (owner - decr);
if ((newown & (RW_THREAD | RW_HAS_WAITERS)) == RW_HAS_WAITERS)
@@ -579,7 +573,7 @@
RW_ASSERT(rw, (op != RW_READER && RW_OWNER(rw) == curthread) ||
(op == RW_READER && RW_COUNT(rw) != 0));
- RW_MEMBAR_ACQUIRE();
+ membar_acquire();
return 1;
}
@@ -606,8 +600,7 @@
__USE(curthread);
#endif
- RW_MEMBAR_RELEASE();
-
+ membar_release();
for (owner = rw->rw_owner;; owner = next) {
/*
* If there are no waiters we can do this the easy way. Try
@@ -705,7 +698,7 @@
newown = curthread | RW_WRITE_LOCKED | (owner & ~RW_THREAD);
next = rw_cas(rw, owner, newown);
if (__predict_true(next == owner)) {
- RW_MEMBAR_ACQUIRE();
+ membar_acquire();
break;
}
RW_ASSERT(rw, (next & RW_WRITE_LOCKED) == 0);
Home |
Main Index |
Thread Index |
Old Index