summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2024-11-27 10:41:39 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2024-11-27 10:41:39 +0000
commitbbd6f23cc124bba1ec3639d9ee424df754d6247a (patch)
tree8b09d5d1a9447cb64e293e9d9faec51e254cb7d2
parentc3a0599eb857ca23bc024e22fe6b0d7e05bc97ea (diff)
Change pgo_get() interface in preparation for running PGO_LOCKED in parallel.
- Do not allocate zero-fill'd pages in uao_get(), leave that for PGO_SYNCIO. - Reduce cosmetic differences between uvn_get() and uao_get() ok tb@
-rw-r--r--sys/uvm/uvm_aobj.c35
-rw-r--r--sys/uvm/uvm_vnode.c23
2 files changed, 15 insertions, 43 deletions
diff --git a/sys/uvm/uvm_aobj.c b/sys/uvm/uvm_aobj.c
index 33e2cb432ab..6ff2abee482 100644
--- a/sys/uvm/uvm_aobj.c
+++ b/sys/uvm/uvm_aobj.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_aobj.c,v 1.110 2024/04/13 23:44:11 jsg Exp $ */
+/* $OpenBSD: uvm_aobj.c,v 1.111 2024/11/27 10:41:38 mpi Exp $ */
/* $NetBSD: uvm_aobj.c,v 1.39 2001/02/18 21:19:08 chs Exp $ */
/*
@@ -1012,7 +1012,6 @@ uao_get(struct uvm_object *uobj, voff_t offset, struct vm_page **pps,
* this if the data structures are locked (i.e. the first
* time through).
*/
-
done = TRUE; /* be optimistic */
gotpages = 0; /* # of pages we got so far */
@@ -1022,35 +1021,17 @@ uao_get(struct uvm_object *uobj, voff_t offset, struct vm_page **pps,
if (pps[lcv] == PGO_DONTCARE)
continue;
+ /* lookup page */
ptmp = uvm_pagelookup(uobj, current_offset);
/*
- * if page is new, attempt to allocate the page,
- * zero-fill'd.
- */
- if (ptmp == NULL && uao_find_swslot(uobj,
- current_offset >> PAGE_SHIFT) == 0) {
- ptmp = uvm_pagealloc(uobj, current_offset,
- NULL, UVM_PGA_ZERO);
- if (ptmp) {
- /* new page */
- atomic_clearbits_int(&ptmp->pg_flags,
- PG_BUSY|PG_FAKE);
- atomic_setbits_int(&ptmp->pg_flags,
- PQ_AOBJ);
- UVM_PAGE_OWN(ptmp, NULL);
- }
- }
-
- /*
* to be useful must get a non-busy page
*/
- if (ptmp == NULL ||
- (ptmp->pg_flags & PG_BUSY) != 0) {
+ if (ptmp == NULL || (ptmp->pg_flags & PG_BUSY) != 0) {
if (lcv == centeridx ||
(flags & PGO_ALLPAGES) != 0)
/* need to do a wait or I/O! */
- done = FALSE;
+ done = FALSE;
continue;
}
@@ -1061,7 +1042,6 @@ uao_get(struct uvm_object *uobj, voff_t offset, struct vm_page **pps,
UVM_PAGE_OWN(ptmp, "uao_get1");
pps[lcv] = ptmp;
gotpages++;
-
}
/*
@@ -1069,12 +1049,7 @@ uao_get(struct uvm_object *uobj, voff_t offset, struct vm_page **pps,
* to unlock and do some waiting or I/O.
*/
*npagesp = gotpages;
- if (done)
- /* bingo! */
- return VM_PAGER_OK;
- else
- /* EEK! Need to unlock and I/O */
- return VM_PAGER_UNLOCK;
+ return done ? VM_PAGER_OK : VM_PAGER_UNLOCK;
}
/*
diff --git a/sys/uvm/uvm_vnode.c b/sys/uvm/uvm_vnode.c
index 8213f2699a4..a8aaa23cb45 100644
--- a/sys/uvm/uvm_vnode.c
+++ b/sys/uvm/uvm_vnode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_vnode.c,v 1.134 2024/10/23 07:18:44 mpi Exp $ */
+/* $OpenBSD: uvm_vnode.c,v 1.135 2024/11/27 10:41:38 mpi Exp $ */
/* $NetBSD: uvm_vnode.c,v 1.36 2000/11/24 20:34:01 chs Exp $ */
/*
@@ -970,7 +970,6 @@ uvn_get(struct uvm_object *uobj, voff_t offset, struct vm_page **pps,
for (lcv = 0, current_offset = offset ; lcv < *npagesp ;
lcv++, current_offset += PAGE_SIZE) {
-
/* do we care about this page? if not, skip it */
if (pps[lcv] == PGO_DONTCARE)
continue;
@@ -978,12 +977,14 @@ uvn_get(struct uvm_object *uobj, voff_t offset, struct vm_page **pps,
/* lookup page */
ptmp = uvm_pagelookup(uobj, current_offset);
- /* to be useful must get a non-busy, non-released pg */
- if (ptmp == NULL ||
- (ptmp->pg_flags & PG_BUSY) != 0) {
- if (lcv == centeridx || (flags & PGO_ALLPAGES)
- != 0)
- done = FALSE; /* need to do a wait or I/O! */
+ /*
+ * to be useful must get a non-busy page
+ */
+ if (ptmp == NULL || (ptmp->pg_flags & PG_BUSY) != 0) {
+ if (lcv == centeridx ||
+ (flags & PGO_ALLPAGES) != 0)
+ /* need to do a wait or I/O! */
+ done = FALSE;
continue;
}
@@ -1014,12 +1015,8 @@ uvn_get(struct uvm_object *uobj, voff_t offset, struct vm_page **pps,
* step 1c: now we've either done everything needed or we to
* unlock and do some waiting or I/O.
*/
-
*npagesp = gotpages; /* let caller know */
- if (done)
- return VM_PAGER_OK; /* bingo! */
- else
- return VM_PAGER_UNLOCK;
+ return done ? VM_PAGER_OK : VM_PAGER_UNLOCK;
}
/*