diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2012-04-15 20:39:37 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2012-04-15 20:39:37 +0000 |
commit | 1988780eca61e41f0d80c1f65987b3bc6f5115be (patch) | |
tree | 133cecb4cbb8f3a1aa89059344b426097106d32d | |
parent | 56335d3b7641d2a700e95c1fb1e256c7af867e35 (diff) |
If the dma-usable area changes after autoconf, recompute the buffer count and
invoke bufadjust() accordingly. Similar to what sysctl kern.bufcachepercent
does.
-rw-r--r-- | sys/arch/sgi/sgi/ip22_machdep.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/arch/sgi/sgi/ip22_machdep.c b/sys/arch/sgi/sgi/ip22_machdep.c index 2d357b9e1bf..9c49a90d58d 100644 --- a/sys/arch/sgi/sgi/ip22_machdep.c +++ b/sys/arch/sgi/sgi/ip22_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip22_machdep.c,v 1.4 2012/04/15 20:38:10 miod Exp $ */ +/* $OpenBSD: ip22_machdep.c,v 1.5 2012/04/15 20:39:36 miod Exp $ */ /* * Copyright (c) 2012 Miodrag Vallat. @@ -19,6 +19,8 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/buf.h> +#include <sys/mount.h> #include <uvm/uvm_extern.h> @@ -338,6 +340,15 @@ ip22_post_autoconf() * Relax DMA-reachable memory constraints if no 28-bit hpc(4) * device has attached. */ - if (hpc_old == 0) + if (hpc_old == 0) { + uint64_t dmapages_before, dmapages; + + dmapages_before = uvm_pagecount(&dma_constraint); dma_constraint.ucr_high = (1UL << 32) - 1; + dmapages = uvm_pagecount(&dma_constraint); + if (dmapages_before != dmapages) { + bufadjust(bufcachepercent * dmapages / 100); + bufhighpages = bufpages; + } + } } |