summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_page.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/uvm/uvm_page.c')
-rw-r--r--sys/uvm/uvm_page.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c
index d40e6a41abb..6a038d8d015 100644
--- a/sys/uvm/uvm_page.c
+++ b/sys/uvm/uvm_page.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_page.c,v 1.100 2010/04/22 19:02:55 oga Exp $ */
+/* $OpenBSD: uvm_page.c,v 1.101 2010/06/27 03:03:49 thib Exp $ */
/* $NetBSD: uvm_page.c,v 1.44 2000/11/27 08:40:04 chs Exp $ */
/*
@@ -777,6 +777,33 @@ uvm_shutdown(void)
}
/*
+ * Perform insert of a given page in the specified anon of obj.
+ * This is basically, uvm_pagealloc, but with the page already given.
+ */
+void
+uvm_pagealloc_pg(struct vm_page *pg, struct uvm_object *obj, voff_t off,
+ struct vm_anon *anon)
+{
+ int flags;
+
+ flags = PG_BUSY | PG_FAKE;
+ pg->offset = off;
+ pg->uobject = obj;
+ pg->uanon = anon;
+
+ if (anon) {
+ anon->an_page = pg;
+ flags |= PQ_ANON;
+ } else if (obj)
+ uvm_pageinsert(pg);
+ atomic_setbits_int(&pg->pg_flags, flags);
+#if defined(UVM_PAGE_TRKOWN)
+ pg->owner_tag = NULL;
+#endif
+ UVM_PAGE_OWN(pg, "new alloc");
+}
+
+/*
* uvm_pagealloc_strat: allocate vm_page from a particular free list.
*
* => return null if no pages free
@@ -836,23 +863,11 @@ uvm_pagealloc(struct uvm_object *obj, voff_t off, struct vm_anon *anon,
pg = TAILQ_FIRST(&pgl);
KASSERT(pg != NULL && TAILQ_NEXT(pg, pageq) == NULL);
- pg->offset = off;
- pg->uobject = obj;
- pg->uanon = anon;
+ uvm_pagealloc_pg(pg, obj, off, anon);
KASSERT((pg->pg_flags & PG_DEV) == 0);
atomic_setbits_int(&pg->pg_flags, PG_BUSY|PG_CLEAN|PG_FAKE);
if (flags & UVM_PGA_ZERO)
atomic_clearbits_int(&pg->pg_flags, PG_CLEAN);
- if (anon) {
- anon->an_page = pg;
- atomic_setbits_int(&pg->pg_flags, PQ_ANON);
- } else if (obj)
- uvm_pageinsert(pg);
-
-#if defined(UVM_PAGE_TRKOWN)
- pg->owner_tag = NULL;
-#endif
- UVM_PAGE_OWN(pg, "new alloc");
UVMHIST_LOG(pghist, "allocated pg %p/%lx", pg,
(u_long)VM_PAGE_TO_PHYS(pg), 0, 0);