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 /sys/uvm | |
parent | 15bca3199004ca05908945845371a22ec6316104 (diff) |
Make mbufs and dma_alloc be contig allocations.
Requested by dlg@
ok oga@
Diffstat (limited to 'sys/uvm')
-rw-r--r-- | sys/uvm/uvm_extern.h | 3 | ||||
-rw-r--r-- | sys/uvm/uvm_km.c | 14 |
2 files changed, 14 insertions, 3 deletions
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 |