[PATCH/RFC] mm/debug_pagealloc: enable it by default

From: Christian Borntraeger
Date: Fri Jan 22 2016 - 06:44:32 EST


since commit 031bc5743f158 ("mm/debug-pagealloc: make debug-pagealloc
boottime configurable") CONFIG_DEBUG_PAGEALLOC is by default a no-op.

This resulted in several unnoticed bugs, e.g.
https://lkml.kernel.org/g/<569F5E29.3090107@xxxxxxxxxx>
or
https://lkml.kernel.org/g/<56A20F30.4050705@xxxxxxxxxx>

as this behaviour change was not even documented in Kconfig.

Let's go back to the original default and reverse the command
line parameter to allow disabling the feature.

Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>
Signed-off-by: Christian Borntraeger <borntraeger@xxxxxxxxxx>
---
Documentation/kernel-parameters.txt | 8 ++++----
mm/Kconfig.debug | 2 ++
mm/page_alloc.c | 6 +++---
3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 742f69d..7553c87 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -854,13 +854,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
tracking down these problems.

debug_pagealloc=
- [KNL] When CONFIG_DEBUG_PAGEALLOC is set, this
- parameter enables the feature at boot time. In
- default, it is disabled. We can avoid allocating huge
+ [KNL] When CONFIG_DEBUG_PAGEALLOC is set to off, this
+ parameter disables the feature at boot time. In
+ default, it is enabled. We can avoid allocating huge
chunk of memory for debug pagealloc if we don't enable
it at boot time and the system will work mostly same
with the kernel built without CONFIG_DEBUG_PAGEALLOC.
- on: enable the feature
+ off: disable the feature

debugpat [X86] Enable PAT debugging

diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug
index 957d3da..3f991a4 100644
--- a/mm/Kconfig.debug
+++ b/mm/Kconfig.debug
@@ -25,6 +25,8 @@ config DEBUG_PAGEALLOC
this option cannot be enabled in combination with hibernation as
that would result in incorrect warnings of memory corruption after
a resume because free pages are not saved to the suspend image.
+ The feature can be disable with the kernel parameter
+ debug_pagealloc=off.

config PAGE_POISONING
bool
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 9d666df..8a03efd 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -479,7 +479,7 @@ void prep_compound_page(struct page *page, unsigned int order)

#ifdef CONFIG_DEBUG_PAGEALLOC
unsigned int _debug_guardpage_minorder;
-bool _debug_pagealloc_enabled __read_mostly;
+bool _debug_pagealloc_enabled __read_mostly = true;
bool _debug_guardpage_enabled __read_mostly;

static int __init early_debug_pagealloc(char *buf)
@@ -487,8 +487,8 @@ static int __init early_debug_pagealloc(char *buf)
if (!buf)
return -EINVAL;

- if (strcmp(buf, "on") == 0)
- _debug_pagealloc_enabled = true;
+ if (strcmp(buf, "off") == 0)
+ _debug_pagealloc_enabled = false;

return 0;
}
--
2.3.0