Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Back out previous. It works on amd64 under stress ...
details: https://anonhg.NetBSD.org/src/rev/83035b094d70
branches: trunk
changeset: 465624:83035b094d70
user: ad <ad%NetBSD.org@localhost>
date: Sat Nov 30 14:21:16 2019 +0000
description:
Back out previous. It works on amd64 under stress test but not
evbarm-aarch64 for some reason. Will revisit.
diffstat:
sys/kern/kern_rwlock.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diffs (67 lines):
diff -r ce1483584210 -r 83035b094d70 sys/kern/kern_rwlock.c
--- a/sys/kern/kern_rwlock.c Sat Nov 30 13:02:18 2019 +0000
+++ b/sys/kern/kern_rwlock.c Sat Nov 30 14:21:16 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_rwlock.c,v 1.57 2019/11/29 20:50:54 ad Exp $ */
+/* $NetBSD: kern_rwlock.c,v 1.58 2019/11/30 14:21:16 ad Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.57 2019/11/29 20:50:54 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.58 2019/11/30 14:21:16 ad Exp $");
#define __RWLOCK_PRIVATE
@@ -417,11 +417,10 @@
* No need for a memory barrier because of context switch.
* If not handed the lock, then spin again.
*/
- if (op == RW_READER)
+ if (op == RW_READER || (rw->rw_owner & RW_THREAD) == curthread)
break;
+
owner = rw->rw_owner;
- if ((owner & RW_THREAD) == curthread)
- break;
}
KPREEMPT_ENABLE(curlwp);
@@ -477,13 +476,14 @@
* lock would become unowned.
*/
RW_MEMBAR_EXIT();
- for (;; owner = next) {
+ for (;;) {
newown = (owner - decr);
if ((newown & (RW_THREAD | RW_HAS_WAITERS)) == RW_HAS_WAITERS)
break;
next = rw_cas(rw, owner, newown);
if (__predict_true(next == owner))
return;
+ owner = next;
}
/*
@@ -568,15 +568,15 @@
need_wait = RW_WRITE_LOCKED | RW_THREAD;
}
- for (owner = 0;; owner = next) {
+ for (owner = rw->rw_owner;; owner = next) {
+ if (__predict_false((owner & need_wait) != 0))
+ return 0;
next = rw_cas(rw, owner, owner + incr);
if (__predict_true(next == owner)) {
/* Got it! */
RW_MEMBAR_ENTER();
break;
}
- if (__predict_false((owner & need_wait) != 0))
- return 0;
}
RW_WANTLOCK(rw, op);
Home |
Main Index |
Thread Index |
Old Index