Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm uvm_fault_{upper, lower}_done: move drop-swap outside...
details: https://anonhg.NetBSD.org/src/rev/20e3d23b255f
branches: trunk
changeset: 755231:20e3d23b255f
user: rmind <rmind%NetBSD.org@localhost>
date: Fri May 28 23:41:14 2010 +0000
description:
uvm_fault_{upper,lower}_done: move drop-swap outside the page-queues lock.
Assert for object lock being held (or ref count 0) in uao_set_swslot().
diffstat:
sys/uvm/uvm_aobj.c | 6 ++++--
sys/uvm/uvm_fault.c | 21 ++++++++++++++++-----
2 files changed, 20 insertions(+), 7 deletions(-)
diffs (107 lines):
diff -r 1d6d9d39832d -r 20e3d23b255f sys/uvm/uvm_aobj.c
--- a/sys/uvm/uvm_aobj.c Fri May 28 19:11:23 2010 +0000
+++ b/sys/uvm/uvm_aobj.c Fri May 28 23:41:14 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_aobj.c,v 1.108 2009/10/21 21:12:07 rmind Exp $ */
+/* $NetBSD: uvm_aobj.c,v 1.109 2010/05/28 23:41:14 rmind Exp $ */
/*
* Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.108 2009/10/21 21:12:07 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.109 2010/05/28 23:41:14 rmind Exp $");
#include "opt_uvmhist.h"
@@ -319,6 +319,8 @@
UVMHIST_LOG(pdhist, "aobj %p pageidx %d slot %d",
aobj, pageidx, slot, 0);
+ KASSERT(mutex_owned(&uobj->vmobjlock) || uobj->uo_refs == 0);
+
/*
* if noswap flag is set, then we can't set a non-zero slot.
*/
diff -r 1d6d9d39832d -r 20e3d23b255f sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c Fri May 28 19:11:23 2010 +0000
+++ b/sys/uvm/uvm_fault.c Fri May 28 23:41:14 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_fault.c,v 1.173 2010/02/24 15:58:26 uebayasi Exp $ */
+/* $NetBSD: uvm_fault.c,v 1.174 2010/05/28 23:41:14 rmind Exp $ */
/*
*
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.173 2010/02/24 15:58:26 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.174 2010/05/28 23:41:14 rmind Exp $");
#include "opt_uvmhist.h"
@@ -1512,6 +1512,8 @@
struct uvm_faultinfo *ufi, struct uvm_faultctx *flt,
struct uvm_object *uobj, struct vm_anon *anon, struct vm_page *pg)
{
+ const bool wire_paging = flt->wire_paging;
+
UVMHIST_FUNC("uvm_fault_upper_done"); UVMHIST_CALLED(maphist);
/*
@@ -1519,7 +1521,7 @@
*/
mutex_enter(&uvm_pageqlock);
- if (flt->wire_paging) {
+ if (wire_paging) {
uvm_pagewire(pg);
/*
@@ -1530,11 +1532,15 @@
*/
pg->flags &= ~(PG_CLEAN);
- uvm_anon_dropswap(anon);
+
} else {
uvm_pageactivate(pg);
}
mutex_exit(&uvm_pageqlock);
+
+ if (wire_paging) {
+ uvm_anon_dropswap(anon);
+ }
}
/*
@@ -2206,6 +2212,8 @@
struct uvm_faultinfo *ufi, struct uvm_faultctx *flt,
struct uvm_object *uobj, struct vm_anon *anon, struct vm_page *pg)
{
+ bool dropswap = false;
+
UVMHIST_FUNC("uvm_fault_lower_done"); UVMHIST_CALLED(maphist);
mutex_enter(&uvm_pageqlock);
@@ -2222,13 +2230,16 @@
KASSERT(uobj != NULL);
pg->flags &= ~(PG_CLEAN);
- uao_dropswap(uobj, pg->offset >> PAGE_SHIFT);
+ dropswap = true;
}
} else {
uvm_pageactivate(pg);
}
mutex_exit(&uvm_pageqlock);
+ if (dropswap) {
+ uao_dropswap(uobj, pg->offset >> PAGE_SHIFT);
+ }
if (pg->flags & PG_WANTED)
wakeup(pg);
Home |
Main Index |
Thread Index |
Old Index