mm/debug-pagealloc: make debug-pagealloc boottime configurable
[linux-2.6-block.git] / mm / page_alloc.c
index e0a39d328ca1881db18147640099cad79fb5d522..303d385168076d558cf50768d24c8ac21354b7c8 100644 (file)
@@ -425,15 +425,35 @@ static inline void prep_zero_page(struct page *page, unsigned int order,
 
 #ifdef CONFIG_DEBUG_PAGEALLOC
 unsigned int _debug_guardpage_minorder;
+bool _debug_pagealloc_enabled __read_mostly;
 bool _debug_guardpage_enabled __read_mostly;
 
+static int __init early_debug_pagealloc(char *buf)
+{
+       if (!buf)
+               return -EINVAL;
+
+       if (strcmp(buf, "on") == 0)
+               _debug_pagealloc_enabled = true;
+
+       return 0;
+}
+early_param("debug_pagealloc", early_debug_pagealloc);
+
 static bool need_debug_guardpage(void)
 {
+       /* If we don't use debug_pagealloc, we don't need guard page */
+       if (!debug_pagealloc_enabled())
+               return false;
+
        return true;
 }
 
 static void init_debug_guardpage(void)
 {
+       if (!debug_pagealloc_enabled())
+               return;
+
        _debug_guardpage_enabled = true;
 }