diff options
author | Joonsoo Kim <iamjoonsoo.kim@lge.com> | 2014-12-12 19:55:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-13 15:42:48 -0500 |
commit | 031bc5743f158b2d5498294f489e534a31251626 (patch) | |
tree | 472c0024f26821a627ec17a2e73a450f450ca4cc /mm | |
parent | e30825f1869a75b29a69dc8e0aaaaccc492092cf (diff) |
mm/debug-pagealloc: make debug-pagealloc boottime configurable
Now, we have prepared to avoid using debug-pagealloc in boottime. So
introduce new kernel-parameter to disable debug-pagealloc in boottime, and
makes related functions to be disabled in this case.
Only non-intuitive part is change of guard page functions. Because guard
page is effective only if debug-pagealloc is enabled, turning off
according to debug-pagealloc is reasonable thing to do.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Dave Hansen <dave@sr71.net>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Jungsoo Son <jungsoo.son@lge.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/debug-pagealloc.c | 8 | ||||
-rw-r--r-- | mm/page_alloc.c | 20 |
2 files changed, 27 insertions, 1 deletions
diff --git a/mm/debug-pagealloc.c b/mm/debug-pagealloc.c index 0072f2c53331..5bf5906ce13b 100644 --- a/mm/debug-pagealloc.c +++ b/mm/debug-pagealloc.c | |||
@@ -10,11 +10,17 @@ static bool page_poisoning_enabled __read_mostly; | |||
10 | 10 | ||
11 | static bool need_page_poisoning(void) | 11 | static bool need_page_poisoning(void) |
12 | { | 12 | { |
13 | if (!debug_pagealloc_enabled()) | ||
14 | return false; | ||
15 | |||
13 | return true; | 16 | return true; |
14 | } | 17 | } |
15 | 18 | ||
16 | static void init_page_poisoning(void) | 19 | static void init_page_poisoning(void) |
17 | { | 20 | { |
21 | if (!debug_pagealloc_enabled()) | ||
22 | return; | ||
23 | |||
18 | page_poisoning_enabled = true; | 24 | page_poisoning_enabled = true; |
19 | } | 25 | } |
20 | 26 | ||
@@ -119,7 +125,7 @@ static void unpoison_pages(struct page *page, int n) | |||
119 | unpoison_page(page + i); | 125 | unpoison_page(page + i); |
120 | } | 126 | } |
121 | 127 | ||
122 | void kernel_map_pages(struct page *page, int numpages, int enable) | 128 | void __kernel_map_pages(struct page *page, int numpages, int enable) |
123 | { | 129 | { |
124 | if (!page_poisoning_enabled) | 130 | if (!page_poisoning_enabled) |
125 | return; | 131 | return; |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e0a39d328ca1..303d38516807 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -425,15 +425,35 @@ static inline void prep_zero_page(struct page *page, unsigned int order, | |||
425 | 425 | ||
426 | #ifdef CONFIG_DEBUG_PAGEALLOC | 426 | #ifdef CONFIG_DEBUG_PAGEALLOC |
427 | unsigned int _debug_guardpage_minorder; | 427 | unsigned int _debug_guardpage_minorder; |
428 | bool _debug_pagealloc_enabled __read_mostly; | ||
428 | bool _debug_guardpage_enabled __read_mostly; | 429 | bool _debug_guardpage_enabled __read_mostly; |
429 | 430 | ||
431 | static int __init early_debug_pagealloc(char *buf) | ||
432 | { | ||
433 | if (!buf) | ||
434 | return -EINVAL; | ||
435 | |||
436 | if (strcmp(buf, "on") == 0) | ||
437 | _debug_pagealloc_enabled = true; | ||
438 | |||
439 | return 0; | ||
440 | } | ||
441 | early_param("debug_pagealloc", early_debug_pagealloc); | ||
442 | |||
430 | static bool need_debug_guardpage(void) | 443 | static bool need_debug_guardpage(void) |
431 | { | 444 | { |
445 | /* If we don't use debug_pagealloc, we don't need guard page */ | ||
446 | if (!debug_pagealloc_enabled()) | ||
447 | return false; | ||
448 | |||
432 | return true; | 449 | return true; |
433 | } | 450 | } |
434 | 451 | ||
435 | static void init_debug_guardpage(void) | 452 | static void init_debug_guardpage(void) |
436 | { | 453 | { |
454 | if (!debug_pagealloc_enabled()) | ||
455 | return; | ||
456 | |||
437 | _debug_guardpage_enabled = true; | 457 | _debug_guardpage_enabled = true; |
438 | } | 458 | } |
439 | 459 | ||