tile: query dynamic DEBUG_PAGEALLOC setting

We can disable debug_pagealloc processing even if the code is compiled
with CONFIG_DEBUG_PAGEALLOC.  This patch changes the code to query
whether it is enabled or not in runtime.

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Chris Metcalf <cmetcalf@ezchip.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Takashi Iwai <tiwai@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Joonsoo Kim 2016-03-17 14:18:02 -07:00 коммит произвёл Linus Torvalds
Родитель e7df0d88c4
Коммит 21c647865a
1 изменённых файлов: 7 добавлений и 4 удалений

Просмотреть файл

@ -896,17 +896,15 @@ void __init pgtable_cache_init(void)
panic("pgtable_cache_init(): Cannot create pgd cache"); panic("pgtable_cache_init(): Cannot create pgd cache");
} }
#ifdef CONFIG_DEBUG_PAGEALLOC
static long __write_once initfree;
#else
static long __write_once initfree = 1; static long __write_once initfree = 1;
#endif static bool __write_once set_initfree_done;
/* Select whether to free (1) or mark unusable (0) the __init pages. */ /* Select whether to free (1) or mark unusable (0) the __init pages. */
static int __init set_initfree(char *str) static int __init set_initfree(char *str)
{ {
long val; long val;
if (kstrtol(str, 0, &val) == 0) { if (kstrtol(str, 0, &val) == 0) {
set_initfree_done = true;
initfree = val; initfree = val;
pr_info("initfree: %s free init pages\n", pr_info("initfree: %s free init pages\n",
initfree ? "will" : "won't"); initfree ? "will" : "won't");
@ -919,6 +917,11 @@ static void free_init_pages(char *what, unsigned long begin, unsigned long end)
{ {
unsigned long addr = (unsigned long) begin; unsigned long addr = (unsigned long) begin;
/* Prefer user request first */
if (!set_initfree_done) {
if (debug_pagealloc_enabled())
initfree = 0;
}
if (kdata_huge && !initfree) { if (kdata_huge && !initfree) {
pr_warn("Warning: ignoring initfree=0: incompatible with kdata=huge\n"); pr_warn("Warning: ignoring initfree=0: incompatible with kdata=huge\n");
initfree = 1; initfree = 1;