svn commit: r189649 - in head/sys: kern sys
John Baldwin
jhb at FreeBSD.org
Tue Mar 10 14:28:44 PDT 2009
Author: jhb
Date: Tue Mar 10 21:28:43 2009
New Revision: 189649
URL: http://svn.freebsd.org/changeset/base/189649
Log:
- Make maxpipekva a signed long rather than an unsigned long as overflow
is more likely to be noticed with signed types.
- Make amountpipekva a long as well to match maxpipekva.
Discussed with: bde
Modified:
head/sys/kern/subr_param.c
head/sys/kern/sys_pipe.c
head/sys/sys/pipe.h
Modified: head/sys/kern/subr_param.c
==============================================================================
--- head/sys/kern/subr_param.c Tue Mar 10 21:27:15 2009 (r189648)
+++ head/sys/kern/subr_param.c Tue Mar 10 21:28:43 2009 (r189649)
@@ -91,7 +91,7 @@ int nbuf;
int nswbuf;
long maxswzone; /* max swmeta KVA storage */
long maxbcache; /* max buffer cache KVA storage */
-u_long maxpipekva; /* Limit on pipe KVA */
+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 */
@@ -282,7 +282,7 @@ init_param3(long kmempages)
maxpipekva = (kmempages / 20) * PAGE_SIZE;
if (maxpipekva < 512 * 1024)
maxpipekva = 512 * 1024;
- TUNABLE_ULONG_FETCH("kern.ipc.maxpipekva", &maxpipekva);
+ TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva);
}
/*
Modified: head/sys/kern/sys_pipe.c
==============================================================================
--- head/sys/kern/sys_pipe.c Tue Mar 10 21:27:15 2009 (r189648)
+++ head/sys/kern/sys_pipe.c Tue Mar 10 21:28:43 2009 (r189649)
@@ -178,15 +178,15 @@ static struct filterops pipe_wfiltops =
#define MINPIPESIZE (PIPE_SIZE/3)
#define MAXPIPESIZE (2*PIPE_SIZE/3)
-static int amountpipekva;
+static long amountpipekva;
static int pipefragretry;
static int pipeallocfail;
static int piperesizefail;
static int piperesizeallowed = 1;
-SYSCTL_ULONG(_kern_ipc, OID_AUTO, maxpipekva, CTLFLAG_RDTUN,
+SYSCTL_LONG(_kern_ipc, OID_AUTO, maxpipekva, CTLFLAG_RDTUN,
&maxpipekva, 0, "Pipe KVA limit");
-SYSCTL_INT(_kern_ipc, OID_AUTO, pipekva, CTLFLAG_RD,
+SYSCTL_LONG(_kern_ipc, OID_AUTO, pipekva, CTLFLAG_RD,
&amountpipekva, 0, "Pipe KVA usage");
SYSCTL_INT(_kern_ipc, OID_AUTO, pipefragretry, CTLFLAG_RD,
&pipefragretry, 0, "Pipe allocation retries due to fragmentation");
@@ -463,7 +463,7 @@ retry:
cpipe->pipe_buffer.in = cnt;
cpipe->pipe_buffer.out = 0;
cpipe->pipe_buffer.cnt = cnt;
- atomic_add_int(&amountpipekva, cpipe->pipe_buffer.size);
+ atomic_add_long(&amountpipekva, cpipe->pipe_buffer.size);
return (0);
}
@@ -1457,7 +1457,7 @@ pipe_free_kmem(cpipe)
("pipe_free_kmem: pipe mutex locked"));
if (cpipe->pipe_buffer.buffer != NULL) {
- atomic_subtract_int(&amountpipekva, cpipe->pipe_buffer.size);
+ atomic_subtract_long(&amountpipekva, cpipe->pipe_buffer.size);
vm_map_remove(pipe_map,
(vm_offset_t)cpipe->pipe_buffer.buffer,
(vm_offset_t)cpipe->pipe_buffer.buffer + cpipe->pipe_buffer.size);
Modified: head/sys/sys/pipe.h
==============================================================================
--- head/sys/sys/pipe.h Tue Mar 10 21:27:15 2009 (r189648)
+++ head/sys/sys/pipe.h Tue Mar 10 21:28:43 2009 (r189649)
@@ -56,7 +56,7 @@
/*
* See sys_pipe.c for info on what these limits mean.
*/
-extern u_long maxpipekva;
+extern long maxpipekva;
/*
* Pipe buffer information.
More information about the svn-src-all
mailing list