aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sysctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r--kernel/sysctl.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 4c93486b45d1..997080f00e0b 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -37,6 +37,7 @@
37#include <linux/highuid.h> 37#include <linux/highuid.h>
38#include <linux/writeback.h> 38#include <linux/writeback.h>
39#include <linux/ratelimit.h> 39#include <linux/ratelimit.h>
40#include <linux/compaction.h>
40#include <linux/hugetlb.h> 41#include <linux/hugetlb.h>
41#include <linux/initrd.h> 42#include <linux/initrd.h>
42#include <linux/key.h> 43#include <linux/key.h>
@@ -262,6 +263,11 @@ static int min_sched_shares_ratelimit = 100000; /* 100 usec */
262static int max_sched_shares_ratelimit = NSEC_PER_SEC; /* 1 second */ 263static int max_sched_shares_ratelimit = NSEC_PER_SEC; /* 1 second */
263#endif 264#endif
264 265
266#ifdef CONFIG_COMPACTION
267static int min_extfrag_threshold;
268static int max_extfrag_threshold = 1000;
269#endif
270
265static struct ctl_table kern_table[] = { 271static struct ctl_table kern_table[] = {
266 { 272 {
267 .procname = "sched_child_runs_first", 273 .procname = "sched_child_runs_first",
@@ -1121,6 +1127,25 @@ static struct ctl_table vm_table[] = {
1121 .mode = 0644, 1127 .mode = 0644,
1122 .proc_handler = drop_caches_sysctl_handler, 1128 .proc_handler = drop_caches_sysctl_handler,
1123 }, 1129 },
1130#ifdef CONFIG_COMPACTION
1131 {
1132 .procname = "compact_memory",
1133 .data = &sysctl_compact_memory,
1134 .maxlen = sizeof(int),
1135 .mode = 0200,
1136 .proc_handler = sysctl_compaction_handler,
1137 },
1138 {
1139 .procname = "extfrag_threshold",
1140 .data = &sysctl_extfrag_threshold,
1141 .maxlen = sizeof(int),
1142 .mode = 0644,
1143 .proc_handler = sysctl_extfrag_handler,
1144 .extra1 = &min_extfrag_threshold,
1145 .extra2 = &max_extfrag_threshold,
1146 },
1147
1148#endif /* CONFIG_COMPACTION */
1124 { 1149 {
1125 .procname = "min_free_kbytes", 1150 .procname = "min_free_kbytes",
1126 .data = &min_free_kbytes, 1151 .data = &min_free_kbytes,
@@ -2262,6 +2287,8 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2262 if (write) { 2287 if (write) {
2263 left -= proc_skip_spaces(&kbuf); 2288 left -= proc_skip_spaces(&kbuf);
2264 2289
2290 if (!left)
2291 break;
2265 err = proc_get_long(&kbuf, &left, &lval, &neg, 2292 err = proc_get_long(&kbuf, &left, &lval, &neg,
2266 proc_wspace_sep, 2293 proc_wspace_sep,
2267 sizeof(proc_wspace_sep), NULL); 2294 sizeof(proc_wspace_sep), NULL);
@@ -2288,7 +2315,7 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2288 2315
2289 if (!write && !first && left && !err) 2316 if (!write && !first && left && !err)
2290 err = proc_put_char(&buffer, &left, '\n'); 2317 err = proc_put_char(&buffer, &left, '\n');
2291 if (write && !err) 2318 if (write && !err && left)
2292 left -= proc_skip_spaces(&kbuf); 2319 left -= proc_skip_spaces(&kbuf);
2293free: 2320free:
2294 if (write) { 2321 if (write) {