mm/debug_pagealloc.c: don't allocate page_ext if we don't use guard page
authorJoonsoo Kim <iamjoonsoo.kim@lge.com>
Sat, 10 Sep 2016 10:34:07 +0000 (20:34 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Sat, 10 Sep 2016 10:34:07 +0000 (20:34 +1000)
What debug_pagealloc does is just mapping/unmapping page table.
Basically, it doesn't need additional memory space to memorize something.
But, with guard page feature, it requires additional memory to distinguish
if the page is for guard or not.  Guard page is only used when
debug_guardpage_minorder is non-zero so this patch removes additional
memory allocation (page_ext) if debug_guardpage_minorder is zero.

It saves memory if we just use debug_pagealloc and not guard page.

Link: http://lkml.kernel.org/r/1471315879-32294-3-git-send-email-iamjoonsoo.kim@lge.com
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/page_alloc.c

index 24856609150f6fec4b02c8903b97557861d85dde..11aabaa45ba5aa3796d18b19b4e7ba3e5945adfc 100644 (file)
@@ -607,6 +607,9 @@ static bool need_debug_guardpage(void)
        if (!debug_pagealloc_enabled())
                return false;
 
+       if (!debug_guardpage_minorder())
+               return false;
+
        return true;
 }
 
@@ -615,6 +618,9 @@ static void init_debug_guardpage(void)
        if (!debug_pagealloc_enabled())
                return;
 
+       if (!debug_guardpage_minorder())
+               return;
+
        _debug_guardpage_enabled = true;
 }
 
@@ -635,7 +641,7 @@ static int __init debug_guardpage_minorder_setup(char *buf)
        pr_info("Setting debug_guardpage_minorder to %lu\n", res);
        return 0;
 }
-__setup("debug_guardpage_minorder=", debug_guardpage_minorder_setup);
+early_param("debug_guardpage_minorder", debug_guardpage_minorder_setup);
 
 static inline bool set_page_guard(struct zone *zone, struct page *page,
                                unsigned int order, int migratetype)
This page took 0.03144 seconds and 5 git commands to generate.