aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorJoonsoo Kim <iamjoonsoo.kim@lge.com>2016-03-17 17:17:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-17 18:09:34 -0400
commitf48d97f340cbb0c323fa7a7b36bd76a108a9f49f (patch)
tree0cc690e92bd4ba6408530b777d3fce63b89e926b /mm
parent0335ddd34f39569a32096084bf3b0960d2b1212b (diff)
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: Joonsoo Kim <iamjoonsoo.kim@lge.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: David 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/vmalloc.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index fb42a5bffe47..d4b2e34adae0 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -531,22 +531,21 @@ static void unmap_vmap_area(struct vmap_area *va)
531static void vmap_debug_free_range(unsigned long start, unsigned long end) 531static void vmap_debug_free_range(unsigned long start, unsigned long end)
532{ 532{
533 /* 533 /*
534 * Unmap page tables and force a TLB flush immediately if 534 * Unmap page tables and force a TLB flush immediately if pagealloc
535 * CONFIG_DEBUG_PAGEALLOC is set. This catches use after free 535 * debugging is enabled. This catches use after free bugs similarly to
536 * bugs similarly to those in linear kernel virtual address 536 * those in linear kernel virtual address space after a page has been
537 * space after a page has been freed. 537 * freed.
538 * 538 *
539 * All the lazy freeing logic is still retained, in order to 539 * All the lazy freeing logic is still retained, in order to minimise
540 * minimise intrusiveness of this debugging feature. 540 * intrusiveness of this debugging feature.
541 * 541 *
542 * This is going to be *slow* (linear kernel virtual address 542 * This is going to be *slow* (linear kernel virtual address debugging
543 * debugging doesn't do a broadcast TLB flush so it is a lot 543 * doesn't do a broadcast TLB flush so it is a lot faster).
544 * faster).
545 */ 544 */
546#ifdef CONFIG_DEBUG_PAGEALLOC 545 if (debug_pagealloc_enabled()) {
547 vunmap_page_range(start, end); 546 vunmap_page_range(start, end);
548 flush_tlb_kernel_range(start, end); 547 flush_tlb_kernel_range(start, end);
549#endif 548 }
550} 549}
551 550
552/* 551/*