summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2011-04-15 21:47:25 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2011-04-15 21:47:25 +0000
commitc5ddad9464398d4ade3321a300801dc031b0f224 (patch)
tree1746a60169c2b5f65815b439558d7c5be3bd53e0 /sys
parent59923c29825f41832e3d6363d04c0e3f0c1b416d (diff)
move uvm_pageratop from uvm_pager.c local to a general uvm function
(uvm_atopg) and use it in uvm_km_doputpage to replace some handrolled code. Shrinks the kernel a trivial amount. ok beck@ and miod@ (who suggested i name it uvm_atopg not uvm_atop)
Diffstat (limited to 'sys')
-rw-r--r--sys/uvm/uvm_glue.c19
-rw-r--r--sys/uvm/uvm_glue.h4
-rw-r--r--sys/uvm/uvm_km.c8
-rw-r--r--sys/uvm/uvm_pager.c24
4 files changed, 25 insertions, 30 deletions
diff --git a/sys/uvm/uvm_glue.c b/sys/uvm/uvm_glue.c
index 7c67202db33..aa55afbd07d 100644
--- a/sys/uvm/uvm_glue.c
+++ b/sys/uvm/uvm_glue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_glue.c,v 1.57 2011/04/07 13:20:25 miod Exp $ */
+/* $OpenBSD: uvm_glue.c,v 1.58 2011/04/15 21:47:24 oga Exp $ */
/* $NetBSD: uvm_glue.c,v 1.44 2001/02/06 19:54:44 eeh Exp $ */
/*
@@ -475,3 +475,20 @@ uvm_swapout_threads(void)
pmap_collect(p->p_vmspace->vm_map.pmap);
}
}
+
+/*
+ * uvm_atopg: convert KVAs back to their page structures.
+ */
+struct vm_page *
+uvm_atopg(vaddr_t kva)
+{
+ struct vm_page *pg;
+ paddr_t pa;
+ boolean_t rv;
+
+ rv = pmap_extract(pmap_kernel(), kva, &pa);
+ KASSERT(rv);
+ pg = PHYS_TO_VM_PAGE(pa);
+ KASSERT(pg != NULL);
+ return (pg);
+}
diff --git a/sys/uvm/uvm_glue.h b/sys/uvm/uvm_glue.h
index cb508aa2314..3ba245bbbc6 100644
--- a/sys/uvm/uvm_glue.h
+++ b/sys/uvm/uvm_glue.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_glue.h,v 1.7 2002/03/14 01:27:18 millert Exp $ */
+/* $OpenBSD: uvm_glue.h,v 1.8 2011/04/15 21:47:24 oga Exp $ */
/* $NetBSD: uvm_glue.h,v 1.6 1999/06/21 17:25:11 thorpej Exp $ */
/*
@@ -46,6 +46,8 @@
void uvm_swapout_threads(void);
+struct vm_page *uvm_atopg(vaddr_t);
+
#endif /* _KERNEL */
#endif /* _UVM_UVM_GLUE_H_ */
diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c
index 0a93cd2c91e..ecc176c6041 100644
--- a/sys/uvm/uvm_km.c
+++ b/sys/uvm/uvm_km.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_km.c,v 1.94 2011/04/07 15:30:16 miod Exp $ */
+/* $OpenBSD: uvm_km.c,v 1.95 2011/04/15 21:47:24 oga Exp $ */
/* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */
/*
@@ -902,11 +902,7 @@ uvm_km_doputpage(struct uvm_km_free_page *fp)
paddr_t pa;
struct uvm_km_free_page *nextfp = fp->next;
- if (!pmap_extract(pmap_kernel(), va, &pa))
- panic("lost pa");
- pg = PHYS_TO_VM_PAGE(pa);
-
- KASSERT(pg != NULL);
+ pg = uvm_atopg(va);
pmap_kremove(va, PAGE_SIZE);
pmap_update(kernel_map->pmap);
diff --git a/sys/uvm/uvm_pager.c b/sys/uvm/uvm_pager.c
index f634caecc96..8247ad51aec 100644
--- a/sys/uvm/uvm_pager.c
+++ b/sys/uvm/uvm_pager.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_pager.c,v 1.57 2010/07/24 15:40:39 kettenis Exp $ */
+/* $OpenBSD: uvm_pager.c,v 1.58 2011/04/15 21:47:24 oga Exp $ */
/* $NetBSD: uvm_pager.c,v 1.36 2000/11/27 18:26:41 chs Exp $ */
/*
@@ -91,8 +91,6 @@ void uvm_pseg_init(struct uvm_pseg *);
vaddr_t uvm_pseg_get(int);
void uvm_pseg_release(vaddr_t);
-struct vm_page *uvm_pageratop(vaddr_t);
-
/*
* uvm_pager_init: init pagers (at boot time)
*/
@@ -830,7 +828,7 @@ uvm_aio_aiodone(struct buf *bp)
uobj = NULL;
for (i = 0; i < npages; i++) {
- pgs[i] = uvm_pageratop((vaddr_t)bp->b_data + (i << PAGE_SHIFT));
+ pgs[i] = uvm_atopg((vaddr_t)bp->b_data + (i << PAGE_SHIFT));
UVMHIST_LOG(pdhist, "pgs[%ld] = %p", i, pgs[i],0,0);
}
uvm_pagermapout((vaddr_t)bp->b_data, npages);
@@ -905,21 +903,3 @@ freed:
}
pool_put(&bufpool, bp);
}
-
-/*
- * uvm_pageratop: convert KVAs in the pager map back to their page
- * structures.
- */
-struct vm_page *
-uvm_pageratop(vaddr_t kva)
-{
- struct vm_page *pg;
- paddr_t pa;
- boolean_t rv;
-
- rv = pmap_extract(pmap_kernel(), kva, &pa);
- KASSERT(rv);
- pg = PHYS_TO_VM_PAGE(pa);
- KASSERT(pg != NULL);
- return (pg);
-}