diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2024-10-02 10:12:53 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2024-10-02 10:12:53 +0000 |
commit | 758e2daca4a8a65318e51031b741d99b10441f91 (patch) | |
tree | 962ae68b764338a161865022a2fc9b82cf47bb3c /sys/arch/arm | |
parent | 9b0df37a32463efc74a0e7572c11ff3ea554f25a (diff) |
Switch PV pool allocator to use km_alloc(9) instead of uvm_km_kmemalloc(9).
Reduce differences between pmaps & allow us to remove another deprecated
allocator.
ok phessler@, miod@
Diffstat (limited to 'sys/arch/arm')
-rw-r--r-- | sys/arch/arm/arm/pmap7.c | 54 |
1 files changed, 14 insertions, 40 deletions
diff --git a/sys/arch/arm/arm/pmap7.c b/sys/arch/arm/arm/pmap7.c index 44bb3b356b3..8ab7c6e2bf2 100644 --- a/sys/arch/arm/arm/pmap7.c +++ b/sys/arch/arm/arm/pmap7.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap7.c,v 1.66 2023/01/01 19:49:17 miod Exp $ */ +/* $OpenBSD: pmap7.c,v 1.67 2024/10/02 10:12:52 mpi Exp $ */ /* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */ /* @@ -238,10 +238,10 @@ struct pool pmap_pmap_pool; * Pool of PV structures */ struct pool pmap_pv_pool; -void *pmap_bootstrap_pv_page_alloc(struct pool *, int, int *); -void pmap_bootstrap_pv_page_free(struct pool *, void *); -struct pool_allocator pmap_bootstrap_pv_allocator = { - pmap_bootstrap_pv_page_alloc, pmap_bootstrap_pv_page_free +void *pmap_pv_page_alloc(struct pool *, int, int *); +void pmap_pv_page_free(struct pool *, void *); +struct pool_allocator pmap_pv_allocator = { + pmap_pv_page_alloc, pmap_pv_page_free }; /* @@ -2360,7 +2360,7 @@ pmap_bootstrap(pd_entry_t *kernel_l1pt, vaddr_t vstart, vaddr_t vend) pool_init(&pmap_pmap_pool, sizeof(struct pmap), 0, IPL_NONE, 0, "pmappl", &pool_allocator_single); pool_init(&pmap_pv_pool, sizeof(struct pv_entry), 0, IPL_VM, 0, - "pvepl", &pmap_bootstrap_pv_allocator); + "pvepl", &pmap_pv_allocator); pool_init(&pmap_l2dtable_pool, sizeof(struct l2_dtable), 0, IPL_VM, 0, "l2dtblpl", NULL); pool_init(&pmap_l2ptp_pool, L2_TABLE_SIZE_REAL, L2_TABLE_SIZE_REAL, @@ -2397,48 +2397,22 @@ pmap_init(void) pmap_initialized = 1; } -static vaddr_t last_bootstrap_page = 0; -static void *free_bootstrap_pages = NULL; - void * -pmap_bootstrap_pv_page_alloc(struct pool *pp, int flags, int *slowdown) +pmap_pv_page_alloc(struct pool *pp, int flags, int *slowdown) { - extern void *pool_page_alloc(struct pool *, int, int *); - vaddr_t new_page; - void *rv; - - if (pmap_initialized) - return (pool_page_alloc(pp, flags, slowdown)); - *slowdown = 0; + struct kmem_dyn_mode kd = KMEM_DYN_INITIALIZER; - if (free_bootstrap_pages) { - rv = free_bootstrap_pages; - free_bootstrap_pages = *((void **)rv); - return (rv); - } - - new_page = uvm_km_kmemalloc(kernel_map, NULL, PAGE_SIZE, - (flags & PR_WAITOK) ? 0 : UVM_KMF_NOWAIT); + kd.kd_waitok = ISSET(flags, PR_WAITOK); + kd.kd_slowdown = slowdown; - last_bootstrap_page = new_page; - return ((void *)new_page); + return (km_alloc(pp->pr_pgsize, + pmap_initialized ? &kv_page : &kv_any, pp->pr_crange, &kd)); } void -pmap_bootstrap_pv_page_free(struct pool *pp, void *v) +pmap_pv_page_free(struct pool *pp, void *v) { - extern void pool_page_free(struct pool *, void *); - - if (pmap_initialized) { - pool_page_free(pp, v); - return; - } - - if ((vaddr_t)v < last_bootstrap_page) { - *((void **)v) = free_bootstrap_pages; - free_bootstrap_pages = v; - return; - } + km_free(v, pp->pr_pgsize, &kv_page, pp->pr_crange); } /* |