mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
mm: more intensive memory corruption debugging
With CONFIG_DEBUG_PAGEALLOC configured, the CPU will generate an exception on access (read,write) to an unallocated page, which permits us to catch code which corrupts memory. However the kernel is trying to maximise memory usage, hence there are usually few free pages in the system and buggy code usually corrupts some crucial data. This patch changes the buddy allocator to keep more free/protected pages and to interlace free/protected and allocated pages to increase the probability of catching corruption. When the kernel is compiled with CONFIG_DEBUG_PAGEALLOC, debug_guardpage_minorder defines the minimum order used by the page allocator to grant a request. The requested size will be returned with the remaining pages used as guard pages. The default value of debug_guardpage_minorder is zero: no change from current behaviour. [[email protected]: tweak documentation, s/flg/flag/] Signed-off-by: Stanislaw Gruszka <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Pekka Enberg <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
1399ff86f2
commit
c0a32fc5a2
5 changed files with 113 additions and 7 deletions
|
|
@ -4,6 +4,7 @@ config DEBUG_PAGEALLOC
|
|||
depends on !HIBERNATION || ARCH_SUPPORTS_DEBUG_PAGEALLOC && !PPC && !SPARC
|
||||
depends on !KMEMCHECK
|
||||
select PAGE_POISONING if !ARCH_SUPPORTS_DEBUG_PAGEALLOC
|
||||
select PAGE_GUARD if ARCH_SUPPORTS_DEBUG_PAGEALLOC
|
||||
---help---
|
||||
Unmap pages from the kernel linear mapping after free_pages().
|
||||
This results in a large slowdown, but helps to find certain types
|
||||
|
|
@ -22,3 +23,7 @@ config WANT_PAGE_DEBUG_FLAGS
|
|||
config PAGE_POISONING
|
||||
bool
|
||||
select WANT_PAGE_DEBUG_FLAGS
|
||||
|
||||
config PAGE_GUARD
|
||||
bool
|
||||
select WANT_PAGE_DEBUG_FLAGS
|
||||
|
|
|
|||
Loading…
Reference in a new issue