diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2015-10-23 09:36:10 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2015-10-23 09:36:10 +0000 |
commit | 04da1ea553719ea97597743333b2bdbb7225fdeb (patch) | |
tree | 9106ad411256d39ca55b0dc9d9ef50ecda678c36 /sys/arch | |
parent | 1357a26894e048f1b737bb0ace0a1a401e2f7b75 (diff) |
Zap pv allocation abstraction layer.
ok mlarkin@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/i386/i386/pmap.c | 48 | ||||
-rw-r--r-- | sys/arch/i386/i386/pmapae.c | 12 | ||||
-rw-r--r-- | sys/arch/i386/include/pmap.h | 9 |
3 files changed, 14 insertions, 55 deletions
diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index 57c2754be49..0338dc848c4 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.185 2015/09/03 18:49:19 kettenis Exp $ */ +/* $OpenBSD: pmap.c,v 1.186 2015/10/23 09:36:09 kettenis Exp $ */ /* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */ /* @@ -1096,42 +1096,6 @@ pmap_init(void) * p v _ e n t r y f u n c t i o n s */ -/* - * pv_entry allocation functions: - * the main pv_entry allocation functions are: - * pmap_alloc_pv: allocate a pv_entry structure - * pmap_free_pv: free one pv_entry - * - * the rest are helper functions - */ - -/* - * pmap_alloc_pv: inline function to allocate a pv_entry structure - * => 3 modes: - * ALLOCPV_NEED = we really need a pv_entry - * ALLOCPV_TRY = we want a pv_entry - * ALLOCPV_NONEED = we are trying to grow our free list, don't really need - * one now - * - * "try" is for optional functions like pmap_copy(). - */ - -struct pv_entry * -pmap_alloc_pv(struct pmap *pmap, int mode) -{ - return pool_get(&pmap_pv_pool, PR_NOWAIT); -} - -/* - * pmap_free_pv: free a single pv_entry - */ - -void -pmap_free_pv(struct pmap *pmap, struct pv_entry *pv) -{ - pool_put(&pmap_pv_pool, pv); -} - void * pmap_pv_page_alloc(struct pool *pp, int flags, int *slowdown) { @@ -1922,7 +1886,7 @@ pmap_do_remove_86(struct pmap *pmap, vaddr_t sva, vaddr_t eva, int flags) while ((pve = free_pvs) != NULL) { free_pvs = pve->pv_next; - pmap_free_pv(pmap, pve); + pool_put(&pmap_pv_pool, pve); } while ((ptp = TAILQ_FIRST(&empty_ptps)) != NULL) { @@ -2016,7 +1980,7 @@ pmap_page_remove_86(struct vm_page *pg) pmap_unmap_ptes_86(pve->pv_pmap); /* unlocks pmap */ pmap_destroy(pve->pv_pmap); - pmap_free_pv(NULL, pve); + pool_put(&pmap_pv_pool, pve); mtx_enter(&pg->mdpage.pv_mtx); } mtx_leave(&pg->mdpage.pv_mtx); @@ -2330,7 +2294,7 @@ pmap_enter_86(struct pmap *pmap, vaddr_t va, paddr_t pa, panic("pmap_enter: missing kernel PTP!"); #endif if (pmap_initialized) - pve = pmap_alloc_pv(pmap, ALLOCPV_NEED); + pve = pool_get(&pmap_pv_pool, PR_NOWAIT); else pve = NULL; wired_count = resident_count = ptp_count = 0; @@ -2506,9 +2470,9 @@ enter_now: out: if (pve) - pmap_free_pv(pmap, pve); + pool_put(&pmap_pv_pool, pve); if (opve) - pmap_free_pv(pmap, opve); + pool_put(&pmap_pv_pool, opve); return error; } diff --git a/sys/arch/i386/i386/pmapae.c b/sys/arch/i386/i386/pmapae.c index 1eb3e15a200..9a55ba8e64c 100644 --- a/sys/arch/i386/i386/pmapae.c +++ b/sys/arch/i386/i386/pmapae.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmapae.c,v 1.46 2015/09/03 18:49:19 kettenis Exp $ */ +/* $OpenBSD: pmapae.c,v 1.47 2015/10/23 09:36:09 kettenis Exp $ */ /* * Copyright (c) 2006-2008 Michael Shalayeff @@ -1159,7 +1159,7 @@ pmap_do_remove_pae(struct pmap *pmap, vaddr_t sva, vaddr_t eva, int flags) while ((pve = free_pvs) != NULL) { free_pvs = pve->pv_next; - pmap_free_pv(pmap, pve); + pool_put(&pmap_pv_pool, pve); } while ((ptp = TAILQ_FIRST(&empty_ptps)) != NULL) { @@ -1253,7 +1253,7 @@ pmap_page_remove_pae(struct vm_page *pg) pmap_unmap_ptes_pae(pve->pv_pmap); /* unlocks pmap */ pmap_destroy(pve->pv_pmap); - pmap_free_pv(NULL, pve); + pool_put(&pmap_pv_pool, pve); mtx_enter(&pg->mdpage.pv_mtx); } mtx_leave(&pg->mdpage.pv_mtx); @@ -1552,7 +1552,7 @@ pmap_enter_pae(struct pmap *pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, #endif if (pmap_initialized) - pve = pmap_alloc_pv(pmap, ALLOCPV_NEED); + pve = pool_get(&pmap_pv_pool, PR_NOWAIT); else pve = NULL; wired_count = resident_count = ptp_count = 0; @@ -1730,9 +1730,9 @@ enter_now: out: if (pve) - pmap_free_pv(pmap, pve); + pool_put(&pmap_pv_pool, pve); if (opve) - pmap_free_pv(pmap, opve); + pool_put(&pmap_pv_pool, opve); return error; } diff --git a/sys/arch/i386/include/pmap.h b/sys/arch/i386/include/pmap.h index 24b1da6109a..6ef814f36e2 100644 --- a/sys/arch/i386/include/pmap.h +++ b/sys/arch/i386/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.78 2015/08/22 07:16:10 mlarkin Exp $ */ +/* $OpenBSD: pmap.h,v 1.79 2015/10/23 09:36:09 kettenis Exp $ */ /* $NetBSD: pmap.h,v 1.44 2000/04/24 17:18:18 thorpej Exp $ */ /* @@ -187,9 +187,7 @@ extern int nkptp_max; #define PMAP_REMOVE_ALL 0 #define PMAP_REMOVE_SKIPWIRED 1 -#define ALLOCPV_NEED 0 /* need PV now */ -#define ALLOCPV_TRY 1 /* just try to allocate */ -#define ALLOCPV_NONEED 2 /* don't need PV, just growing cache */ +extern struct pool pmap_pv_pool; /* * Macros @@ -234,11 +232,8 @@ void pmap_kenter_pa(vaddr_t, paddr_t, vm_prot_t); void pmap_kremove(vaddr_t, vsize_t); void pmap_zero_page(struct vm_page *); void pmap_copy_page(struct vm_page *, struct vm_page *); -struct pv_entry *pmap_alloc_pv(struct pmap *, int); void pmap_enter_pv(struct vm_page *, struct pv_entry *, struct pmap *, vaddr_t, struct vm_page *); -void pmap_free_pv(struct pmap *, struct pv_entry *); -void pmap_free_pvs(struct pmap *, struct pv_entry *); boolean_t pmap_clear_attrs(struct vm_page *, int); static void pmap_page_protect(struct vm_page *, vm_prot_t); void pmap_page_remove(struct vm_page *); |