Commit d9ee35ac authored by Vlastimil Babka's avatar Vlastimil Babka Committed by Ingo Molnar

x86/mm: Disable 1GB direct mappings when disabling 2MB mappings

The kmemleak and debug_pagealloc features both disable using huge pages for
direct mappings so they can do cpa() on page level granularity in any context.

However they only do that for 2MB pages, which means 1GB pages can still be
used if the CPU supports it, unless disabled by a boot param, which is
non-obvious. Disable also 1GB pages when disabling 2MB pages.
Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vegard Nossum <vegardno@ifi.uio.no>
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/2be70c78-6130-855d-3dfa-d87bd1dd4fda@suse.czSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 8a524f80
...@@ -161,16 +161,16 @@ static int page_size_mask; ...@@ -161,16 +161,16 @@ static int page_size_mask;
static void __init probe_page_size_mask(void) static void __init probe_page_size_mask(void)
{ {
#if !defined(CONFIG_KMEMCHECK)
/* /*
* For CONFIG_KMEMCHECK or pagealloc debugging, identity mapping will * For CONFIG_KMEMCHECK or pagealloc debugging, identity mapping will
* use small pages. * use small pages.
* This will simplify cpa(), which otherwise needs to support splitting * This will simplify cpa(), which otherwise needs to support splitting
* large pages into small in interrupt context, etc. * large pages into small in interrupt context, etc.
*/ */
if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled()) if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled() && !IS_ENABLED(CONFIG_KMEMCHECK))
page_size_mask |= 1 << PG_LEVEL_2M; page_size_mask |= 1 << PG_LEVEL_2M;
#endif else
direct_gbpages = 0;
/* Enable PSE if available */ /* Enable PSE if available */
if (boot_cpu_has(X86_FEATURE_PSE)) if (boot_cpu_has(X86_FEATURE_PSE))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment