summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/dma_alloc.c4
-rw-r--r--sys/kern/subr_pool.c56
-rw-r--r--sys/kern/uipc_mbuf.c6
3 files changed, 30 insertions, 36 deletions
diff --git a/sys/kern/dma_alloc.c b/sys/kern/dma_alloc.c
index 55989077def..a38a48f7d2a 100644
--- a/sys/kern/dma_alloc.c
+++ b/sys/kern/dma_alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dma_alloc.c,v 1.7 2011/04/06 15:52:13 art Exp $ */
+/* $OpenBSD: dma_alloc.c,v 1.8 2011/04/18 19:23:46 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], &dma_constraint, 1);
+ pool_set_constraints(&dmapools[i], &kp_dma);
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 da4937c12d1..fcc74a92fd6 100644
--- a/sys/kern/subr_pool.c
+++ b/sys/kern/subr_pool.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_pool.c,v 1.103 2011/04/06 15:52:13 art Exp $ */
+/* $OpenBSD: subr_pool.c,v 1.104 2011/04/18 19:23:46 art Exp $ */
/* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */
/*-
@@ -401,8 +401,7 @@ pool_init(struct pool *pp, size_t size, u_int align, u_int ioff, int flags,
}
/* pglistalloc/constraint parameters */
- pp->pr_crange = &no_constraint;
- pp->pr_pa_nsegs = 0;
+ pp->pr_crange = &kp_dirty;
/* Insert this into the list of all pools. */
TAILQ_INSERT_HEAD(&pool_head, pp, pr_poollist);
@@ -1013,18 +1012,9 @@ done:
}
void
-pool_set_constraints(struct pool *pp, struct uvm_constraint_range *range,
- int nsegs)
+pool_set_constraints(struct pool *pp, const struct kmem_pa_mode *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;
+ pp->pr_crange = mode;
}
void
@@ -1495,32 +1485,36 @@ pool_allocator_free(struct pool *pp, void *v)
void *
pool_page_alloc(struct pool *pp, int flags, int *slowdown)
{
- int kfl = (flags & PR_WAITOK) ? 0 : UVM_KMF_NOWAIT;
+ struct kmem_dyn_mode kd = KMEM_DYN_INITIALIZER;
+
+ kd.kd_waitok = (flags & PR_WAITOK);
+ kd.kd_slowdown = slowdown;
- return (uvm_km_getpage_pla(kfl, slowdown, pp->pr_crange->ucr_low,
- pp->pr_crange->ucr_high, 0, 0));
+ return (km_alloc(PAGE_SIZE, &kv_page, pp->pr_crange, &kd));
}
void
pool_page_free(struct pool *pp, void *v)
{
- uvm_km_putpage(v);
+ km_free(v, PAGE_SIZE, &kv_page, pp->pr_crange);
}
void *
pool_large_alloc(struct pool *pp, int flags, int *slowdown)
{
- int kfl = (flags & PR_WAITOK) ? 0 : UVM_KMF_NOWAIT;
- vaddr_t va;
+ struct kmem_dyn_mode kd = KMEM_DYN_INITIALIZER;
+ void *v;
int s;
+ kd.kd_waitok = (flags & PR_WAITOK);
+ kd.kd_slowdown = slowdown;
+
s = splvm();
- 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);
+ v = km_alloc(pp->pr_alloc->pa_pagesz, &kv_intrsafe, pp->pr_crange,
+ &kd);
splx(s);
- return ((void *)va);
+ return (v);
}
void
@@ -1529,23 +1523,23 @@ pool_large_free(struct pool *pp, void *v)
int s;
s = splvm();
- uvm_km_free(kmem_map, (vaddr_t)v, pp->pr_alloc->pa_pagesz);
+ km_free(v, pp->pr_alloc->pa_pagesz, &kv_intrsafe, pp->pr_crange);
splx(s);
}
void *
pool_large_alloc_ni(struct pool *pp, int flags, int *slowdown)
{
- int kfl = (flags & PR_WAITOK) ? 0 : UVM_KMF_NOWAIT;
+ struct kmem_dyn_mode kd = KMEM_DYN_INITIALIZER;
+
+ kd.kd_waitok = (flags & PR_WAITOK);
+ kd.kd_slowdown = slowdown;
- 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));
+ return (km_alloc(pp->pr_alloc->pa_pagesz, &kv_any, pp->pr_crange, &kd));
}
void
pool_large_free_ni(struct pool *pp, void *v)
{
- uvm_km_free(kernel_map, (vaddr_t)v, pp->pr_alloc->pa_pagesz);
+ km_free(v, pp->pr_alloc->pa_pagesz, &kv_any, pp->pr_crange);
}
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 6e5be38f154..221109171a9 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf.c,v 1.155 2011/04/11 13:10:13 claudio Exp $ */
+/* $OpenBSD: uipc_mbuf.c,v 1.156 2011/04/18 19:23:46 art Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@@ -141,7 +141,7 @@ mbinit(void)
int i;
pool_init(&mbpool, MSIZE, 0, 0, 0, "mbpl", NULL);
- pool_set_constraints(&mbpool, &dma_constraint, 1);
+ pool_set_constraints(&mbpool, &kp_dma);
pool_setlowat(&mbpool, mblowat);
for (i = 0; i < nitems(mclsizes); i++) {
@@ -149,7 +149,7 @@ mbinit(void)
mclsizes[i] >> 10);
pool_init(&mclpools[i], mclsizes[i], 0, 0, 0,
mclnames[i], NULL);
- pool_set_constraints(&mclpools[i], &dma_constraint, 1);
+ pool_set_constraints(&mclpools[i], &kp_dma);
pool_setlowat(&mclpools[i], mcllowat);
}