summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_param.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-03-09 19:35:20 +0000
committerjhb <jhb@FreeBSD.org>2009-03-09 19:35:20 +0000
commit80d9458a56d4f116af5709e969c6178012c2c0c5 (patch)
treefa5afa97f873f392e028df96bcfc150033e0a387 /sys/kern/subr_param.c
parentbf8b9802a6f18a57e942003c695f03173d6947d8 (diff)
downloadFreeBSD-src-80d9458a56d4f116af5709e969c6178012c2c0c5.zip
FreeBSD-src-80d9458a56d4f116af5709e969c6178012c2c0c5.tar.gz
Adjust some variables (mostly related to the buffer cache) that hold
address space sizes to be longs instead of ints. Specifically, the follow values are now longs: runningbufspace, bufspace, maxbufspace, bufmallocspace, maxbufmallocspace, lobufspace, hibufspace, lorunningspace, hirunningspace, maxswzone, maxbcache, and maxpipekva. Previously, a relatively small number (~ 44000) of buffers set in kern.nbuf would result in integer overflows resulting either in hangs or bogus values of hidirtybuffers and lodirtybuffers. Now one has to overflow a long to see such problems. There was a check for a nbuf setting that would cause overflows in the auto-tuning of nbuf. I've changed it to always check and cap nbuf but warn if a user-supplied tunable would cause overflow. Note that this changes the ABI of several sysctls that are used by things like top(1), etc., so any MFC would probably require a some gross shims to allow for that. MFC after: 1 month
Diffstat (limited to 'sys/kern/subr_param.c')
-rw-r--r--sys/kern/subr_param.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c
index f626ddb..3ec49e8 100644
--- a/sys/kern/subr_param.c
+++ b/sys/kern/subr_param.c
@@ -89,9 +89,9 @@ int maxfilesperproc; /* per-proc open files limit */
int ncallout; /* maximum # of timer events */
int nbuf;
int nswbuf;
-int maxswzone; /* max swmeta KVA storage */
-int maxbcache; /* max buffer cache KVA storage */
-int maxpipekva; /* Limit on pipe KVA */
+long maxswzone; /* max swmeta KVA storage */
+long maxbcache; /* max buffer cache KVA storage */
+u_long maxpipekva; /* Limit on pipe KVA */
int vm_guest; /* Running as virtual machine guest? */
u_long maxtsiz; /* max text size */
u_long dfldsiz; /* initial data size limit */
@@ -203,11 +203,11 @@ init_param1(void)
#ifdef VM_SWZONE_SIZE_MAX
maxswzone = VM_SWZONE_SIZE_MAX;
#endif
- TUNABLE_INT_FETCH("kern.maxswzone", &maxswzone);
+ TUNABLE_LONG_FETCH("kern.maxswzone", &maxswzone);
#ifdef VM_BCACHE_SIZE_MAX
maxbcache = VM_BCACHE_SIZE_MAX;
#endif
- TUNABLE_INT_FETCH("kern.maxbcache", &maxbcache);
+ TUNABLE_LONG_FETCH("kern.maxbcache", &maxbcache);
maxtsiz = MAXTSIZ;
TUNABLE_ULONG_FETCH("kern.maxtsiz", &maxtsiz);
@@ -282,7 +282,7 @@ init_param3(long kmempages)
maxpipekva = (kmempages / 20) * PAGE_SIZE;
if (maxpipekva < 512 * 1024)
maxpipekva = 512 * 1024;
- TUNABLE_INT_FETCH("kern.ipc.maxpipekva", &maxpipekva);
+ TUNABLE_ULONG_FETCH("kern.ipc.maxpipekva", &maxpipekva);
}
/*
OpenPOWER on IntegriCloud