kmemleak: Add support for memory hotplug
Ensure that memory hotplug can co-exist with kmemleak by taking the hotplug lock before scanning the memory banks. Change-Id: Ice6e5eaac45b4d71848ff1d3f30d468c1f088232 Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
This commit is contained in:
@@ -413,7 +413,7 @@ config SLUB_STATS
|
|||||||
|
|
||||||
config DEBUG_KMEMLEAK
|
config DEBUG_KMEMLEAK
|
||||||
bool "Kernel memory leak detector"
|
bool "Kernel memory leak detector"
|
||||||
depends on DEBUG_KERNEL && EXPERIMENTAL && !MEMORY_HOTPLUG && \
|
depends on DEBUG_KERNEL && EXPERIMENTAL && \
|
||||||
(X86 || ARM || PPC || MIPS || S390 || SPARC64 || SUPERH || MICROBLAZE || TILE)
|
(X86 || ARM || PPC || MIPS || S390 || SPARC64 || SUPERH || MICROBLAZE || TILE)
|
||||||
|
|
||||||
select DEBUG_FS
|
select DEBUG_FS
|
||||||
|
|||||||
@@ -100,6 +100,7 @@
|
|||||||
|
|
||||||
#include <linux/kmemcheck.h>
|
#include <linux/kmemcheck.h>
|
||||||
#include <linux/kmemleak.h>
|
#include <linux/kmemleak.h>
|
||||||
|
#include <linux/memory_hotplug.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Kmemleak configuration and common defines.
|
* Kmemleak configuration and common defines.
|
||||||
@@ -1220,9 +1221,9 @@ static void kmemleak_scan(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Struct page scanning for each node. The code below is not yet safe
|
* Struct page scanning for each node.
|
||||||
* with MEMORY_HOTPLUG.
|
|
||||||
*/
|
*/
|
||||||
|
lock_memory_hotplug();
|
||||||
for_each_online_node(i) {
|
for_each_online_node(i) {
|
||||||
pg_data_t *pgdat = NODE_DATA(i);
|
pg_data_t *pgdat = NODE_DATA(i);
|
||||||
unsigned long start_pfn = pgdat->node_start_pfn;
|
unsigned long start_pfn = pgdat->node_start_pfn;
|
||||||
@@ -1241,6 +1242,7 @@ static void kmemleak_scan(void)
|
|||||||
scan_block(page, page + 1, NULL, 1);
|
scan_block(page, page + 1, NULL, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unlock_memory_hotplug();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scanning the task stacks (may introduce false negatives).
|
* Scanning the task stacks (may introduce false negatives).
|
||||||
|
|||||||
Reference in New Issue
Block a user