diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2013-06-11 19:01:21 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2013-06-11 19:01:21 +0000 |
commit | a04cd4407a8b46989eda57407c34a81fd0c94229 (patch) | |
tree | 582a477b3a0350d8234ed93d0ec5b3e361db2bb5 /sys/kern/kern_sysctl.c | |
parent | b46bdc87d12f64a73dd9be1af6eea4e8c42f227e (diff) |
High memory page flipping for the buffer cache.
This change splits the buffer cache free lists into lists of dma reachable
buffers and high memory buffers based on the ranges returned by pmemrange.
Buffers move from dma to high memory as they age, but are flipped to dma
reachable memory if IO is needed to/from and high mem buffer. The total
amount of buffers allocated is now bufcachepercent of both the dma and
the high memory region.
This change allows the use of large buffer caches on amd64 using more than
4 GB of memory
ok tedu@ krw@ - testing by many.
Diffstat (limited to 'sys/kern/kern_sysctl.c')
-rw-r--r-- | sys/kern/kern_sysctl.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 9f1a51d8dad..094720abbea 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.236 2013/06/09 13:10:19 miod Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.237 2013/06/11 19:01:20 beck Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -110,6 +110,7 @@ extern struct disklist_head disklist; extern fixpt_t ccpu; extern long numvnodes; extern u_int mcllivelocks; +extern psize_t b_dmapages_total, b_highpages_total, b_dmamaxpages; extern void nmbclust_update(void); @@ -566,8 +567,8 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, return (sysctl_cptime2(name + 1, namelen -1, oldp, oldlenp, newp, newlen)); case KERN_CACHEPCT: { - u_int64_t dmapages; - int opct, pgs; + psize_t pgs; + int opct; opct = bufcachepercent; error = sysctl_int(oldp, oldlenp, newp, newlen, &bufcachepercent); @@ -577,9 +578,11 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, bufcachepercent = opct; return (EINVAL); } - dmapages = uvm_pagecount(&dma_constraint); if (bufcachepercent != opct) { - pgs = bufcachepercent * dmapages / 100; + pgs = (b_highpages_total + b_dmapages_total) + * bufcachepercent / 100; + b_dmamaxpages = b_dmapages_total * bufcachepercent + / 100; bufadjust(pgs); /* adjust bufpages */ bufhighpages = bufpages; /* set high water mark */ } |