Commit f48d97f3 authored by Joonsoo Kim's avatar Joonsoo Kim Committed by Linus Torvalds

mm/vmalloc: query dynamic DEBUG_PAGEALLOC setting

As CONFIG_DEBUG_PAGEALLOC can be enabled/disabled via kernel parameters
we can optimize some cases by checking the enablement state.

This is follow-up work for Christian's Optimize CONFIG_DEBUG_PAGEALLOC:

  https://lkml.org/lkml/2016/1/27/194

Remaining work is to make sparc to be aware of this but it looks not
easy for me so I skip that in this series.

This patch (of 5):

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

[akpm@linux-foundation.org: update comment, per David.  Adjust comment to use 80 cols]
Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
Reviewed-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Chris Metcalf <cmetcalf@ezchip.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0335ddd3
...@@ -531,22 +531,21 @@ static void unmap_vmap_area(struct vmap_area *va) ...@@ -531,22 +531,21 @@ static void unmap_vmap_area(struct vmap_area *va)
static void vmap_debug_free_range(unsigned long start, unsigned long end) static void vmap_debug_free_range(unsigned long start, unsigned long end)
{ {
/* /*
* Unmap page tables and force a TLB flush immediately if * Unmap page tables and force a TLB flush immediately if pagealloc
* CONFIG_DEBUG_PAGEALLOC is set. This catches use after free * debugging is enabled. This catches use after free bugs similarly to
* bugs similarly to those in linear kernel virtual address * those in linear kernel virtual address space after a page has been
* space after a page has been freed. * freed.
* *
* All the lazy freeing logic is still retained, in order to * All the lazy freeing logic is still retained, in order to minimise
* minimise intrusiveness of this debugging feature. * intrusiveness of this debugging feature.
* *
* This is going to be *slow* (linear kernel virtual address * This is going to be *slow* (linear kernel virtual address debugging
* debugging doesn't do a broadcast TLB flush so it is a lot * doesn't do a broadcast TLB flush so it is a lot faster).
* faster).
*/ */
#ifdef CONFIG_DEBUG_PAGEALLOC if (debug_pagealloc_enabled()) {
vunmap_page_range(start, end); vunmap_page_range(start, end);
flush_tlb_kernel_range(start, end); flush_tlb_kernel_range(start, end);
#endif }
} }
/* /*
......
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