Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm band-aid fix after the merge of rmind-uvmplock branch.
details: https://anonhg.NetBSD.org/src/rev/7042ba5403f8
branches: trunk
changeset: 766337:7042ba5403f8
user: yamt <yamt%NetBSD.org@localhost>
date: Mon Jun 20 23:18:58 2011 +0000
description:
band-aid fix after the merge of rmind-uvmplock branch.
diffstat:
sys/uvm/uvm_pdpolicy_clockpro.c | 52 ++++++++++++++++++++++++++++++----------
1 files changed, 39 insertions(+), 13 deletions(-)
diffs (162 lines):
diff -r 3d90fae932f2 -r 7042ba5403f8 sys/uvm/uvm_pdpolicy_clockpro.c
--- a/sys/uvm/uvm_pdpolicy_clockpro.c Mon Jun 20 23:00:53 2011 +0000
+++ b/sys/uvm/uvm_pdpolicy_clockpro.c Mon Jun 20 23:18:58 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_pdpolicy_clockpro.c,v 1.16 2011/02/05 13:33:47 yamt Exp $ */
+/* $NetBSD: uvm_pdpolicy_clockpro.c,v 1.17 2011/06/20 23:18:58 yamt Exp $ */
/*-
* Copyright (c)2005, 2006 YAMAMOTO Takashi,
@@ -43,7 +43,7 @@
#else /* defined(PDSIM) */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clockpro.c,v 1.16 2011/02/05 13:33:47 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clockpro.c,v 1.17 2011/06/20 23:18:58 yamt Exp $");
#include "opt_ddb.h"
@@ -54,6 +54,7 @@
#include <sys/hash.h>
#include <uvm/uvm.h>
+#include <uvm/uvm_pdaemon.h> /* for uvmpd_trylockowner */
#include <uvm/uvm_pdpolicy.h>
#include <uvm/uvm_pdpolicy_impl.h>
@@ -117,6 +118,9 @@
PDPOL_EVCNT_DEFINE(speculativehit2)
PDPOL_EVCNT_DEFINE(speculativemiss)
+PDPOL_EVCNT_DEFINE(locksuccess)
+PDPOL_EVCNT_DEFINE(lockfail)
+
#define PQ_REFERENCED PQ_PRIVATE1
#define PQ_HOT PQ_PRIVATE2
#define PQ_TEST PQ_PRIVATE3
@@ -630,21 +634,37 @@
}
static void
-clockpro_movereferencebit(struct vm_page *pg)
+clockpro_movereferencebit(struct vm_page *pg, bool locked)
{
+ kmutex_t *lock;
bool referenced;
+ KASSERT(!locked || uvm_page_locked_p(pg));
+ if (!locked) {
+ lock = uvmpd_trylockowner(pg);
+ if (lock == NULL) {
+ /*
+ * XXXuvmplock
+ */
+ PDPOL_EVCNT_INCR(lockfail);
+ return;
+ }
+ PDPOL_EVCNT_INCR(locksuccess);
+ }
referenced = pmap_clear_reference(pg);
+ if (!locked) {
+ mutex_exit(lock);
+ }
if (referenced) {
pg->pqflags |= PQ_REFERENCED;
}
}
static void
-clockpro_clearreferencebit(struct vm_page *pg)
+clockpro_clearreferencebit(struct vm_page *pg, bool locked)
{
- clockpro_movereferencebit(pg);
+ clockpro_movereferencebit(pg, locked);
pg->pqflags &= ~PQ_REFERENCED;
}
@@ -660,7 +680,7 @@
KASSERT(pg != NULL);
KASSERT(clockpro_getq(pg) == CLOCKPRO_NEWQ);
if ((pg->pqflags & PQ_INITIALREF) != 0) {
- clockpro_clearreferencebit(pg);
+ clockpro_clearreferencebit(pg, false);
pg->pqflags &= ~PQ_INITIALREF;
}
/* place at the list head */
@@ -763,7 +783,7 @@
pg->pqflags |= PQ_TEST;
}
s->s_ncold++;
- clockpro_clearreferencebit(pg);
+ clockpro_clearreferencebit(pg, false);
clockpro___enqueuetail(pg);
#else /* defined(USEONCE2) */
if (speculative) {
@@ -929,7 +949,7 @@
dump("hot done");
return;
}
- clockpro_movereferencebit(pg);
+ clockpro_movereferencebit(pg, false);
if ((pg->pqflags & PQ_REFERENCED) == 0) {
PDPOL_EVCNT_INCR(hhotunref);
uvmexp.pddeact++;
@@ -1016,7 +1036,7 @@
#endif /* defined(LISTQ) */
KASSERT((pg->pqflags & PQ_HOT) == 0);
uvmexp.pdscans++;
- clockpro_movereferencebit(pg);
+ clockpro_movereferencebit(pg, false);
if ((pg->pqflags & PQ_SPECULATIVE) != 0) {
KASSERT((pg->pqflags & PQ_TEST) == 0);
if ((pg->pqflags & PQ_REFERENCED) != 0) {
@@ -1088,7 +1108,7 @@
uvmpdpol_pagedeactivate(struct vm_page *pg)
{
- clockpro_clearreferencebit(pg);
+ clockpro_clearreferencebit(pg, true);
}
void
@@ -1110,7 +1130,7 @@
if (uvmpdpol_pageisqueued_p(pg)) {
return;
}
- clockpro_clearreferencebit(pg);
+ clockpro_clearreferencebit(pg, true);
pg->pqflags |= PQ_SPECULATIVE;
clockpro_pageenqueue(pg);
#else
@@ -1267,6 +1287,12 @@
#if defined(DDB)
+#if 0 /* XXXuvmplock */
+#define _pmap_is_referenced(pg) pmap_is_referenced(pg)
+#else
+#define _pmap_is_referenced(pg) false
+#endif
+
void clockpro_dump(void);
void
@@ -1299,7 +1325,7 @@
if ((pg->pqflags & PQ_INITIALREF) != 0) { \
ninitialref++; \
} else if ((pg->pqflags & PQ_REFERENCED) != 0 || \
- pmap_is_referenced(pg)) { \
+ _pmap_is_referenced(pg)) { \
nref++; \
} \
}
@@ -1381,7 +1407,7 @@
(pg->pqflags & PQ_HOT) ? "H" : "",
(pg->pqflags & PQ_TEST) ? "T" : "",
(pg->pqflags & PQ_REFERENCED) ? "R" : "",
- pmap_is_referenced(pg) ? "r" : "",
+ _pmap_is_referenced(pg) ? "r" : "",
(pg->pqflags & PQ_INITIALREF) ? "I" : "",
(pg->pqflags & PQ_SPECULATIVE) ? "S" : ""
);
Home |
Main Index |
Thread Index |
Old Index