summaryrefslogtreecommitdiff
path: root/sys/uvm
diff options
context:
space:
mode:
Diffstat (limited to 'sys/uvm')
-rw-r--r--sys/uvm/uvm.h5
-rw-r--r--sys/uvm/uvm_page.c4
-rw-r--r--sys/uvm/uvm_page.h6
-rw-r--r--sys/uvm/uvm_pdaemon.c16
-rw-r--r--sys/uvm/uvm_vnode.c7
5 files changed, 17 insertions, 21 deletions
diff --git a/sys/uvm/uvm.h b/sys/uvm/uvm.h
index ebccdcc2219..22e9323d15d 100644
--- a/sys/uvm/uvm.h
+++ b/sys/uvm/uvm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm.h,v 1.28 2009/04/06 12:02:52 oga Exp $ */
+/* $OpenBSD: uvm.h,v 1.29 2009/04/13 22:17:54 oga Exp $ */
/* $NetBSD: uvm.h,v 1.24 2000/11/27 08:40:02 chs Exp $ */
/*
@@ -80,7 +80,8 @@ struct uvm {
struct pglist page_active; /* allocated pages, in use */
struct pglist page_inactive_swp;/* pages inactive (reclaim or free) */
struct pglist page_inactive_obj;/* pages inactive (reclaim or free) */
- simple_lock_data_t pageqlock; /* lock for active/inactive page q */
+ /* Lock order: object lock, pageqlock, then fpageqlock. */
+ struct mutex pageqlock; /* lock for active/inactive page q */
struct mutex fpageqlock; /* lock for free page q */
boolean_t page_init_done; /* TRUE if uvm_page_init() finished */
boolean_t page_idle_zero; /* TRUE if we should try to zero
diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c
index f635cc2a98b..3b2ea4c3ba4 100644
--- a/sys/uvm/uvm_page.c
+++ b/sys/uvm/uvm_page.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_page.c,v 1.73 2009/04/06 17:03:51 oga Exp $ */
+/* $OpenBSD: uvm_page.c,v 1.74 2009/04/13 22:17:54 oga Exp $ */
/* $NetBSD: uvm_page.c,v 1.44 2000/11/27 08:40:04 chs Exp $ */
/*
@@ -233,7 +233,7 @@ uvm_page_init(vaddr_t *kvm_startp, vaddr_t *kvm_endp)
TAILQ_INIT(&uvm.page_active);
TAILQ_INIT(&uvm.page_inactive_swp);
TAILQ_INIT(&uvm.page_inactive_obj);
- simple_lock_init(&uvm.pageqlock);
+ mtx_init(&uvm.pageqlock, IPL_NONE);
mtx_init(&uvm.fpageqlock, IPL_VM);
/*
diff --git a/sys/uvm/uvm_page.h b/sys/uvm/uvm_page.h
index 646b24b2043..b06f464d7ce 100644
--- a/sys/uvm/uvm_page.h
+++ b/sys/uvm/uvm_page.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_page.h,v 1.30 2009/04/06 17:03:51 oga Exp $ */
+/* $OpenBSD: uvm_page.h,v 1.31 2009/04/13 22:17:54 oga Exp $ */
/* $NetBSD: uvm_page.h,v 1.19 2000/12/28 08:24:55 chs Exp $ */
/*
@@ -304,8 +304,8 @@ int vm_physseg_find(paddr_t, int *);
* macros
*/
-#define uvm_lock_pageq() simple_lock(&uvm.pageqlock)
-#define uvm_unlock_pageq() simple_unlock(&uvm.pageqlock)
+#define uvm_lock_pageq() mtx_enter(&uvm.pageqlock)
+#define uvm_unlock_pageq() mtx_leave(&uvm.pageqlock)
#define uvm_lock_fpageq() mtx_enter(&uvm.fpageqlock);
#define uvm_unlock_fpageq() mtx_leave(&uvm.fpageqlock);
diff --git a/sys/uvm/uvm_pdaemon.c b/sys/uvm/uvm_pdaemon.c
index e15a24b95f2..bcfde9be6df 100644
--- a/sys/uvm/uvm_pdaemon.c
+++ b/sys/uvm/uvm_pdaemon.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_pdaemon.c,v 1.38 2009/04/06 12:02:52 oga Exp $ */
+/* $OpenBSD: uvm_pdaemon.c,v 1.39 2009/04/13 22:17:54 oga Exp $ */
/* $NetBSD: uvm_pdaemon.c,v 1.23 2000/08/20 10:24:14 bjh21 Exp $ */
/*
@@ -860,13 +860,6 @@ uvmpd_scan_inactive(struct pglist *pglst)
&nextpg))
/* uobj died after release */
uobj = NULL;
-
- /*
- * lock page queues here so that they're
- * always locked at the end of the loop.
- */
-
- uvm_lock_pageq();
}
} else { /* page was not released during I/O */
uvm_lock_pageq();
@@ -900,6 +893,9 @@ uvmpd_scan_inactive(struct pglist *pglst)
else if (uobj)
simple_unlock(&uobj->vmobjlock);
+ if (nextpg && (nextpg->pg_flags & PQ_INACTIVE) == 0) {
+ nextpg = TAILQ_FIRST(pglst); /* reload! */
+ }
} else {
/*
@@ -916,10 +912,6 @@ uvmpd_scan_inactive(struct pglist *pglst)
uvm_lock_pageq();
}
-
- if (nextpg && (nextpg->pg_flags & PQ_INACTIVE) == 0) {
- nextpg = TAILQ_FIRST(pglst); /* reload! */
- }
}
return (retval);
}
diff --git a/sys/uvm/uvm_vnode.c b/sys/uvm/uvm_vnode.c
index 138fb9dab22..1e06956e93e 100644
--- a/sys/uvm/uvm_vnode.c
+++ b/sys/uvm/uvm_vnode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_vnode.c,v 1.54 2009/04/05 18:11:03 oga Exp $ */
+/* $OpenBSD: uvm_vnode.c,v 1.55 2009/04/13 22:17:54 oga Exp $ */
/* $NetBSD: uvm_vnode.c,v 1.36 2000/11/24 20:34:01 chs Exp $ */
/*
@@ -1127,7 +1127,10 @@ ReTry:
UVM_PAGE_OWN(ptmp, NULL);
if (ptmp->pg_flags & PG_RELEASED) {
- /* pgo_releasepg wants this */
+ /*
+ * pgo_releasepg needs to grab the
+ * pageq lock itself.
+ */
uvm_unlock_pageq();
if (!uvn_releasepg(ptmp, NULL))
return (TRUE);