diff options
author | Ariane van der Steldt <ariane@cvs.openbsd.org> | 2011-06-23 21:42:06 +0000 |
---|---|---|
committer | Ariane van der Steldt <ariane@cvs.openbsd.org> | 2011-06-23 21:42:06 +0000 |
commit | f6072dd442f07ea7c3ed10002ec772a84cbaf881 (patch) | |
tree | 200f9b7f7c2c9161c03f9bac7419aefe3746eb0b | |
parent | 15bca3199004ca05908945845371a22ec6316104 (diff) |
Make mbufs and dma_alloc be contig allocations.
Requested by dlg@
ok oga@
-rw-r--r-- | sys/kern/dma_alloc.c | 4 | ||||
-rw-r--r-- | sys/kern/uipc_mbuf.c | 6 | ||||
-rw-r--r-- | sys/uvm/uvm_extern.h | 3 | ||||
-rw-r--r-- | sys/uvm/uvm_km.c | 14 |
4 files changed, 19 insertions, 8 deletions
diff --git a/sys/kern/dma_alloc.c b/sys/kern/dma_alloc.c index a38a48f7d2a..504f75c7e26 100644 --- a/sys/kern/dma_alloc.c +++ b/sys/kern/dma_alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dma_alloc.c,v 1.8 2011/04/18 19:23:46 art Exp $ */ +/* $OpenBSD: dma_alloc.c,v 1.9 2011/06/23 21:42:05 ariane 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], &kp_dma_contig); pool_setipl(&dmapools[i], IPL_VM); /* XXX need pool_setlowat(&dmapools[i], dmalowat); */ } diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 24f877c607f..71019564e19 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.157 2011/05/04 16:05:49 blambert Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.158 2011/06/23 21:42:05 ariane 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, &kp_dma); + pool_set_constraints(&mbpool, &kp_dma_contig); 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], &kp_dma); + pool_set_constraints(&mclpools[i], &kp_dma_contig); pool_setlowat(&mclpools[i], mcllowat); } diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h index 80d97ca82f8..dc09c4d6708 100644 --- a/sys/uvm/uvm_extern.h +++ b/sys/uvm/uvm_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_extern.h,v 1.98 2011/06/06 17:10:23 ariane Exp $ */ +/* $OpenBSD: uvm_extern.h,v 1.99 2011/06/23 21:42:05 ariane Exp $ */ /* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */ /* @@ -616,6 +616,7 @@ extern const struct kmem_va_mode kv_page; extern const struct kmem_pa_mode kp_dirty; extern const struct kmem_pa_mode kp_zero; extern const struct kmem_pa_mode kp_dma; +extern const struct kmem_pa_mode kp_dma_contig; extern const struct kmem_pa_mode kp_dma_zero; extern const struct kmem_pa_mode kp_pageable; extern const struct kmem_pa_mode kp_none; diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c index d9bf54bbbc4..f3af1016803 100644 --- a/sys/uvm/uvm_km.c +++ b/sys/uvm/uvm_km.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_km.c,v 1.103 2011/06/06 17:10:23 ariane Exp $ */ +/* $OpenBSD: uvm_km.c,v 1.104 2011/06/23 21:42:05 ariane Exp $ */ /* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */ /* @@ -847,6 +847,7 @@ km_alloc(size_t sz, const struct kmem_va_mode *kv, int mapflags = 0; vm_prot_t prot; int pla_flags; + int pla_maxseg; #ifdef __HAVE_PMAP_DIRECT paddr_t pa; #endif @@ -864,9 +865,13 @@ km_alloc(size_t sz, const struct kmem_va_mode *kv, if (kp->kp_zero) pla_flags |= UVM_PLA_ZERO; + pla_maxseg = kp->kp_maxseg; + if (pla_maxseg == 0) + pla_maxseg = sz / PAGE_SIZE; + if (uvm_pglistalloc(sz, kp->kp_constraint->ucr_low, kp->kp_constraint->ucr_high, kp->kp_align, kp->kp_boundary, - &pgl, sz / PAGE_SIZE, pla_flags)) { + &pgl, pla_maxseg, pla_flags)) { return (NULL); } @@ -1055,6 +1060,11 @@ const struct kmem_pa_mode kp_dma = { .kp_constraint = &dma_constraint }; +const struct kmem_pa_mode kp_dma_contig = { + .kp_constraint = &dma_constraint, + .kp_maxseg = 1 +}; + const struct kmem_pa_mode kp_dma_zero = { .kp_constraint = &dma_constraint, .kp_zero = 1 |