summaryrefslogtreecommitdiff
path: root/sys/uvm
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2024-11-05 08:16:41 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2024-11-05 08:16:41 +0000
commit0a8c5bf55f199638885c50544e916d6d57709f40 (patch)
treee6116b6ef13f14e2edd828d4209868483e4027dc /sys/uvm
parent332f81a414324963b30dc56071d676714986f238 (diff)
Do not put wired pages on the page queues & release their swap resources.
While here move the code to release swap resources outside of the pageq mutex and shuffle some locking dances to reduce differences with NetBSD. ok miod@
Diffstat (limited to 'sys/uvm')
-rw-r--r--sys/uvm/uvm_fault.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/sys/uvm/uvm_fault.c b/sys/uvm/uvm_fault.c
index dd7c9cb2b65..aeffd85e880 100644
--- a/sys/uvm/uvm_fault.c
+++ b/sys/uvm/uvm_fault.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_fault.c,v 1.141 2024/11/05 08:15:01 mpi Exp $ */
+/* $OpenBSD: uvm_fault.c,v 1.142 2024/11/05 08:16:40 mpi Exp $ */
/* $NetBSD: uvm_fault.c,v 1.51 2000/08/06 00:22:53 thorpej Exp $ */
/*
@@ -1075,9 +1075,14 @@ uvm_fault_upper(struct uvm_faultinfo *ufi, struct uvm_faultctx *flt,
* ... update the page queues.
*/
uvm_lock_pageq();
-
- if (fault_type == VM_FAULT_WIRE) {
+ if (flt->wired) {
uvm_pagewire(pg);
+ } else {
+ uvm_pageactivate(pg);
+ }
+ uvm_unlock_pageq();
+
+ if (flt->wired) {
/*
* since the now-wired page cannot be paged out,
* release its swap resources for others to use.
@@ -1086,13 +1091,8 @@ uvm_fault_upper(struct uvm_faultinfo *ufi, struct uvm_faultctx *flt,
*/
atomic_clearbits_int(&pg->pg_flags, PG_CLEAN);
uvm_anon_dropswap(anon);
- } else {
- /* activate it */
- uvm_pageactivate(pg);
}
- uvm_unlock_pageq();
-
/*
* done case 1! finish up by unlocking everything and returning success
*/
@@ -1206,7 +1206,7 @@ uvm_fault_lower(struct uvm_faultinfo *ufi, struct uvm_faultctx *flt,
struct vm_amap *amap = ufi->entry->aref.ar_amap;
struct uvm_object *uobj = ufi->entry->object.uvm_obj;
boolean_t promote, locked;
- int result;
+ int result, dropswap = 0;
struct vm_page *uobjpage, *pg = NULL;
struct vm_anon *anon = NULL;
voff_t uoff;
@@ -1538,10 +1538,9 @@ uvm_fault_lower(struct uvm_faultinfo *ufi, struct uvm_faultctx *flt,
return ERESTART;
}
- if (fault_type == VM_FAULT_WIRE) {
- uvm_lock_pageq();
+ uvm_lock_pageq();
+ if (flt->wired) {
uvm_pagewire(pg);
- uvm_unlock_pageq();
if (pg->pg_flags & PQ_AOBJ) {
/*
* since the now-wired page cannot be paged out,
@@ -1556,14 +1555,15 @@ uvm_fault_lower(struct uvm_faultinfo *ufi, struct uvm_faultctx *flt,
KASSERT(uobj != NULL);
KASSERT(uobj->vmobjlock == pg->uobject->vmobjlock);
atomic_clearbits_int(&pg->pg_flags, PG_CLEAN);
- uao_dropswap(uobj, pg->offset >> PAGE_SHIFT);
+ dropswap = 1;
}
} else {
- /* activate it */
- uvm_lock_pageq();
uvm_pageactivate(pg);
- uvm_unlock_pageq();
}
+ uvm_unlock_pageq();
+
+ if (dropswap)
+ uao_dropswap(uobj, pg->offset >> PAGE_SHIFT);
if (pg->pg_flags & PG_WANTED)
wakeup(pg);