mm: Add min_free_order_shift tunable.
authorArve Hjønnevåg <arve@android.com>
Tue, 17 Feb 2009 22:51:02 +0000 (14:51 -0800)
committerArve Hjønnevåg <arve@android.com>
Mon, 1 Jul 2013 20:40:18 +0000 (13:40 -0700)
By default the kernel tries to keep half as much memory free at each
order as it does for one order below. This can be too agressive when
running without swap.

Change-Id: I5efc1a0b50f41ff3ac71e92d2efd175dedd54ead
Signed-off-by: Arve Hjønnevåg <arve@android.com>
kernel/sysctl.c
mm/page_alloc.c

index 9edcf456e0fcaa16e929b8a87c6229e33d24efa8..1a07798c91463ea7365c8ca980b214828ed79d35 100644 (file)
@@ -105,6 +105,7 @@ extern char core_pattern[];
 extern unsigned int core_pipe_limit;
 #endif
 extern int pid_max;
+extern int min_free_order_shift;
 extern int pid_max_min, pid_max_max;
 extern int percpu_pagelist_fraction;
 extern int compat_log;
@@ -1265,6 +1266,13 @@ static struct ctl_table vm_table[] = {
                .proc_handler   = min_free_kbytes_sysctl_handler,
                .extra1         = &zero,
        },
+       {
+               .procname       = "min_free_order_shift",
+               .data           = &min_free_order_shift,
+               .maxlen         = sizeof(min_free_order_shift),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec
+       },
        {
                .procname       = "percpu_pagelist_fraction",
                .data           = &percpu_pagelist_fraction,
index c3edb624fccf30c303ccff94cf139e090b416d7e..58f55f605ad3e49d77cec377cf3954325f92d59c 100644 (file)
@@ -197,6 +197,7 @@ static char * const zone_names[MAX_NR_ZONES] = {
 };
 
 int min_free_kbytes = 1024;
+int min_free_order_shift = 1;
 
 static unsigned long __meminitdata nr_kernel_pages;
 static unsigned long __meminitdata nr_all_pages;
@@ -1648,7 +1649,7 @@ static bool __zone_watermark_ok(struct zone *z, int order, unsigned long mark,
                free_pages -= z->free_area[o].nr_free << o;
 
                /* Require fewer higher order pages to be free */
-               min >>= 1;
+               min >>= min_free_order_shift;
 
                if (free_pages <= min)
                        return false;