Skip to content

Commit

Permalink
mm/vmalloc: query dynamic DEBUG_PAGEALLOC setting
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joonsoo Kim authored and Linus Torvalds committed Mar 17, 2016
1 parent 0335ddd commit f48d97f
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions mm/vmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
/*
* Unmap page tables and force a TLB flush immediately if
* CONFIG_DEBUG_PAGEALLOC is set. This catches use after free
* bugs similarly to those in linear kernel virtual address
* space after a page has been freed.
* Unmap page tables and force a TLB flush immediately if pagealloc
* debugging is enabled. This catches use after free bugs similarly to
* those in linear kernel virtual address space after a page has been
* freed.
*
* All the lazy freeing logic is still retained, in order to
* minimise intrusiveness of this debugging feature.
* All the lazy freeing logic is still retained, in order to minimise
* intrusiveness of this debugging feature.
*
* This is going to be *slow* (linear kernel virtual address
* debugging doesn't do a broadcast TLB flush so it is a lot
* faster).
* This is going to be *slow* (linear kernel virtual address debugging
* doesn't do a broadcast TLB flush so it is a lot faster).
*/
#ifdef CONFIG_DEBUG_PAGEALLOC
vunmap_page_range(start, end);
flush_tlb_kernel_range(start, end);
#endif
if (debug_pagealloc_enabled()) {
vunmap_page_range(start, end);
flush_tlb_kernel_range(start, end);
}
}

/*
Expand Down

0 comments on commit f48d97f

Please sign in to comment.