diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2010-05-19 15:03:16 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2010-05-21 15:12:52 -0400 |
commit | b492e95be0ae672922f4734acf3f5d35c30be948 (patch) | |
tree | a8a1e7f035903796e6b8f626add8d269bf989a35 /kernel | |
parent | 35f3d14dbbc58447c61e38a162ea10add6b31dc7 (diff) |
pipe: set lower and upper limit on max pages in the pipe page array
We need at least two to guarantee proper POSIX behaviour, so
never allow a smaller limit than that.
Also expose a /proc/sys/fs/pipe-max-pages sysctl file that allows
root to define a sane upper limit. Make it default to 16 times the
default size, which is 16 pages.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sysctl.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 8686b0f5fc12..c649d1c5fe09 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/slow-work.h> | 52 | #include <linux/slow-work.h> |
53 | #include <linux/perf_event.h> | 53 | #include <linux/perf_event.h> |
54 | #include <linux/kprobes.h> | 54 | #include <linux/kprobes.h> |
55 | #include <linux/pipe_fs_i.h> | ||
55 | 56 | ||
56 | #include <asm/uaccess.h> | 57 | #include <asm/uaccess.h> |
57 | #include <asm/processor.h> | 58 | #include <asm/processor.h> |
@@ -1423,6 +1424,14 @@ static struct ctl_table fs_table[] = { | |||
1423 | .child = binfmt_misc_table, | 1424 | .child = binfmt_misc_table, |
1424 | }, | 1425 | }, |
1425 | #endif | 1426 | #endif |
1427 | { | ||
1428 | .procname = "pipe-max-pages", | ||
1429 | .data = &pipe_max_pages, | ||
1430 | .maxlen = sizeof(int), | ||
1431 | .mode = 0644, | ||
1432 | .proc_handler = &proc_dointvec_minmax, | ||
1433 | .extra1 = &two, | ||
1434 | }, | ||
1426 | /* | 1435 | /* |
1427 | * NOTE: do not add new entries to this table unless you have read | 1436 | * NOTE: do not add new entries to this table unless you have read |
1428 | * Documentation/sysctl/ctl_unnumbered.txt | 1437 | * Documentation/sysctl/ctl_unnumbered.txt |