-/* $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 $ */
/*
* 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)
{
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) {
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);
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;
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;
}
-/* $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
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) {
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);
#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;
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;
}
-/* $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 $ */
/*
#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
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 *);