summaryrefslogtreecommitdiffstats
path: root/sys/sys/pipe.h
diff options
context:
space:
mode:
authorsilby <silby@FreeBSD.org>2003-07-08 04:02:31 +0000
committersilby <silby@FreeBSD.org>2003-07-08 04:02:31 +0000
commitbba10d998e419f6ed907ed3c7ad0e83367130a8b (patch)
tree9c5cab30d524265b507e10b143f719a6bed5f78d /sys/sys/pipe.h
parentb685cb57329c13bdbf99cb8ed187b00a64b51c27 (diff)
downloadFreeBSD-src-bba10d998e419f6ed907ed3c7ad0e83367130a8b.zip
FreeBSD-src-bba10d998e419f6ed907ed3c7ad0e83367130a8b.tar.gz
Put some concrete limits on pipe memory consumption:
- Limit the total number of pipes so that we do not exhaust all vm objects in the kernel map. When this limit is reached, a ratelimited message will be printed to the console. - Put a soft limit on the amount of memory consumable by pipes. Once the limit has been reached, all new pipes will be limited to 4K in size, rather than the default of 16K. - Put a limit on the number of pages that may be used for high speed page flipping in order to reduce the amount of wired memory. Pipe writes that occur while this limit is exceeded will fall back to non-page flipping mode. The above values are auto-tuned in subr_param.c and are scaled to take into account both the size of physical memory and the size of the kernel map. These limits help to reduce the "kernel resources exhausted" panics that could be caused by opening a large number of pipes. (Pipes alone are no longer able to exhaust all resources, but other kernel memory hogs in league with pipes may still be able to do so.) PR: 53627 Ideas / comments from: hsu, tjr, dillon@apollo.backplane.com MFC after: 1 week
Diffstat (limited to 'sys/sys/pipe.h')
-rw-r--r--sys/sys/pipe.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/sys/pipe.h b/sys/sys/pipe.h
index edbb388..f28d4ed 100644
--- a/sys/sys/pipe.h
+++ b/sys/sys/pipe.h
@@ -43,6 +43,10 @@
#define BIG_PIPE_SIZE (64*1024)
#endif
+#ifndef SMALL_PIPE_SIZE
+#define SMALL_PIPE_SIZE 4096
+#endif
+
/*
* PIPE_MINDIRECT MUST be smaller than PIPE_SIZE and MUST be bigger
* than PIPE_BUF.
@@ -54,6 +58,13 @@
#define PIPENPAGES (BIG_PIPE_SIZE / PAGE_SIZE + 1)
/*
+ * See sys_pipe.c for info on what these limits mean.
+ */
+extern int maxpipes;
+extern int maxpipekva;
+extern int maxpipekvawired;
+
+/*
* Pipe buffer information.
* Separate in, out, cnt are used to simplify calculations.
* Buffered write is active when the buffer.cnt field is set.
OpenPOWER on IntegriCloud