diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2011-04-06 15:52:14 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2011-04-06 15:52:14 +0000 |
commit | ace3f5313d3ed5313fbfc9c4add15781b29c344a (patch) | |
tree | c9f5c164c2700b33d111d6518c40d515b3dcd2d1 /sys/kern | |
parent | 253d341f5752763e0a967d48e5f20b575864ae90 (diff) |
Backout the uvm_km_getpage -> km_alloc conversion. Weird things are happening
and we aren't sure what's causing them.
shouted oks by many before I even built a kernel with the diff.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/dma_alloc.c | 4 | ||||
-rw-r--r-- | sys/kern/subr_pool.c | 56 | ||||
-rw-r--r-- | sys/kern/uipc_mbuf.c | 6 |
3 files changed, 36 insertions, 30 deletions
diff --git a/sys/kern/dma_alloc.c b/sys/kern/dma_alloc.c index 84c82e517c7..55989077def 100644 --- a/sys/kern/dma_alloc.c +++ b/sys/kern/dma_alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dma_alloc.c,v 1.6 2011/04/05 01:28:05 art Exp $ */ +/* $OpenBSD: dma_alloc.c,v 1.7 2011/04/06 15:52:13 art Exp $ */ /* * Copyright (c) 2010 Theo de Raadt <deraadt@openbsd.org> * @@ -37,7 +37,7 @@ dma_alloc_init(void) 1 << (i + DMA_BUCKET_OFFSET)); pool_init(&dmapools[i], 1 << (i + DMA_BUCKET_OFFSET), 0, 0, 0, dmanames[i], NULL); - pool_set_constraints(&dmapools[i], &kp_dma); + pool_set_constraints(&dmapools[i], &dma_constraint, 1); pool_setipl(&dmapools[i], IPL_VM); /* XXX need pool_setlowat(&dmapools[i], dmalowat); */ } diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c index c6189ffe431..da4937c12d1 100644 --- a/sys/kern/subr_pool.c +++ b/sys/kern/subr_pool.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_pool.c,v 1.102 2011/04/05 01:28:05 art Exp $ */ +/* $OpenBSD: subr_pool.c,v 1.103 2011/04/06 15:52:13 art Exp $ */ /* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */ /*- @@ -401,7 +401,8 @@ pool_init(struct pool *pp, size_t size, u_int align, u_int ioff, int flags, } /* pglistalloc/constraint parameters */ - pp->pr_crange = &kp_dirty; + pp->pr_crange = &no_constraint; + pp->pr_pa_nsegs = 0; /* Insert this into the list of all pools. */ TAILQ_INSERT_HEAD(&pool_head, pp, pr_poollist); @@ -1012,9 +1013,18 @@ done: } void -pool_set_constraints(struct pool *pp, struct kmem_pa_mode *mode) +pool_set_constraints(struct pool *pp, struct uvm_constraint_range *range, + int nsegs) { - pp->pr_crange = mode; + /* + * Subsequent changes to the constrictions are only + * allowed to make them _more_ strict. + */ + KASSERT(pp->pr_crange->ucr_high >= range->ucr_high && + pp->pr_crange->ucr_low <= range->ucr_low); + + pp->pr_crange = range; + pp->pr_pa_nsegs = nsegs; } void @@ -1485,36 +1495,32 @@ pool_allocator_free(struct pool *pp, void *v) void * pool_page_alloc(struct pool *pp, int flags, int *slowdown) { - struct kmem_dyn_mode kd = KMEM_DYN_INITIALIZER; - - kd.kd_waitok = (flags & PR_WAITOK); - kd.kd_slowdown = slowdown; + int kfl = (flags & PR_WAITOK) ? 0 : UVM_KMF_NOWAIT; - return (km_alloc(PAGE_SIZE, &kv_page, pp->pr_crange, &kd)); + return (uvm_km_getpage_pla(kfl, slowdown, pp->pr_crange->ucr_low, + pp->pr_crange->ucr_high, 0, 0)); } void pool_page_free(struct pool *pp, void *v) { - km_free(v, PAGE_SIZE, &kv_page, pp->pr_crange); + uvm_km_putpage(v); } void * pool_large_alloc(struct pool *pp, int flags, int *slowdown) { - struct kmem_dyn_mode kd = KMEM_DYN_INITIALIZER; - void *v; + int kfl = (flags & PR_WAITOK) ? 0 : UVM_KMF_NOWAIT; + vaddr_t va; int s; - kd.kd_waitok = (flags & PR_WAITOK); - kd.kd_slowdown = slowdown; - s = splvm(); - v = km_alloc(pp->pr_alloc->pa_pagesz, &kv_intrsafe, pp->pr_crange, - &kd); + va = uvm_km_kmemalloc_pla(kmem_map, NULL, pp->pr_alloc->pa_pagesz, 0, + kfl, pp->pr_crange->ucr_low, pp->pr_crange->ucr_high, + 0, 0, pp->pr_pa_nsegs); splx(s); - return (v); + return ((void *)va); } void @@ -1523,23 +1529,23 @@ pool_large_free(struct pool *pp, void *v) int s; s = splvm(); - km_free(v, pp->pr_alloc->pa_pagesz, &kv_intrsafe, pp->pr_crange); + uvm_km_free(kmem_map, (vaddr_t)v, pp->pr_alloc->pa_pagesz); splx(s); } void * pool_large_alloc_ni(struct pool *pp, int flags, int *slowdown) { - struct kmem_dyn_mode kd = KMEM_DYN_INITIALIZER; - - kd.kd_waitok = (flags & PR_WAITOK); - kd.kd_slowdown = slowdown; + int kfl = (flags & PR_WAITOK) ? 0 : UVM_KMF_NOWAIT; - return (km_alloc(pp->pr_alloc->pa_pagesz, &kv_any, pp->pr_crange, &kd)); + return ((void *)uvm_km_kmemalloc_pla(kernel_map, uvm.kernel_object, + pp->pr_alloc->pa_pagesz, 0, kfl, + pp->pr_crange->ucr_low, pp->pr_crange->ucr_high, + 0, 0, pp->pr_pa_nsegs)); } void pool_large_free_ni(struct pool *pp, void *v) { - km_free(v, pp->pr_alloc->pa_pagesz, &kv_any, pp->pr_crange); + uvm_km_free(kernel_map, (vaddr_t)v, pp->pr_alloc->pa_pagesz); } diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index af6894429de..4f5800d9d50 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.152 2011/04/05 11:48:28 blambert Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.153 2011/04/06 15:52:13 art Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -138,7 +138,7 @@ mbinit(void) int i; pool_init(&mbpool, MSIZE, 0, 0, 0, "mbpl", NULL); - pool_set_constraints(&mbpool, &kp_dma); + pool_set_constraints(&mbpool, &dma_constraint, 1); pool_setlowat(&mbpool, mblowat); for (i = 0; i < nitems(mclsizes); i++) { @@ -146,7 +146,7 @@ mbinit(void) mclsizes[i] >> 10); pool_init(&mclpools[i], mclsizes[i], 0, 0, 0, mclnames[i], NULL); - pool_set_constraints(&mclpools[i], &kp_dma); + pool_set_constraints(&mclpools[i], &dma_constraint, 1); pool_setlowat(&mclpools[i], mcllowat); } |