Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1663073
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] x86, mm: disable 1GB direct mapping when disabling 2MB mapping |
| Date | 2017-06-11 10:00 +0200 |
| Message-ID | <tR5WV-2lr-7@gated-at.bofh.it> (permalink) |
| References | <tQsCe-2cm-23@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
* Vlastimil Babka <vbabka@suse.cz> wrote: > The kmemleak and debug_pagealloc features both disable using huge pages for > direct mapping 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: Vlastimil Babka <vbabka@suse.cz> > --- > arch/x86/mm/init.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c > index cbc87ea98751..20282dfce0fa 100644 > --- a/arch/x86/mm/init.c > +++ b/arch/x86/mm/init.c > @@ -170,6 +170,10 @@ static void __init probe_page_size_mask(void) > */ > if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled()) > page_size_mask |= 1 << PG_LEVEL_2M; > + else > + direct_gbpages = 0; > +#else > + direct_gbpages = 0; > #endif > > /* Enable PSE if available */ So I agree with the fix, but I think it would be much cleaner to eliminate the outer #ifdef: #if !defined(CONFIG_KMEMCHECK) and put it into the condition, like this: if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled() && !IS_ENABLED(CONFIG_KMEMCHECK)) page_size_mask |= 1 << PG_LEVEL_2M; else direct_gbpages = 0; without any #ifdeffery. This makes it much more readable all around, and also makes it obvious that when the 2MB size bit is not set then gbpages are disabled as well. Thanks, Ingo
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] x86, mm: disable 1GB direct mapping when disabling 2MB mapping Vlastimil Babka <vbabka@suse.cz> - 2017-06-09 16:00 +0200
Re: [PATCH] x86, mm: disable 1GB direct mapping when disabling 2MB mapping Ingo Molnar <mingo@kernel.org> - 2017-06-11 10:00 +0200
Re: [PATCH] x86, mm: disable 1GB direct mapping when disabling 2MB mapping Vlastimil Babka <vbabka@suse.cz> - 2017-06-12 09:30 +0200
[tip:x86/urgent] x86/mm: Disable 1GB direct mappings when disabling 2MB mappings tip-bot for Vlastimil Babka <tipbot@zytor.com> - 2017-06-13 12:10 +0200
csiph-web