Commit 029aeff5db879afd7760f11214b6fea45f76b58e

Authored by Laura Abbott
Committed by Catalin Marinas
1 parent f528f0b8e5

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.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

Showing 2 changed files with 5 additions and 3 deletions Side-by-side Diff

... ... @@ -414,7 +414,7 @@
414 414  
415 415 config DEBUG_KMEMLEAK
416 416 bool "Kernel memory leak detector"
417   - depends on DEBUG_KERNEL && EXPERIMENTAL && !MEMORY_HOTPLUG && \
  417 + depends on DEBUG_KERNEL && EXPERIMENTAL && \
418 418 (X86 || ARM || PPC || MIPS || S390 || SPARC64 || SUPERH || MICROBLAZE || TILE)
419 419  
420 420 select DEBUG_FS
... ... @@ -100,6 +100,7 @@
100 100  
101 101 #include <linux/kmemcheck.h>
102 102 #include <linux/kmemleak.h>
  103 +#include <linux/memory_hotplug.h>
103 104  
104 105 /*
105 106 * Kmemleak configuration and common defines.
106 107  
... ... @@ -1292,9 +1293,9 @@
1292 1293 #endif
1293 1294  
1294 1295 /*
1295   - * Struct page scanning for each node. The code below is not yet safe
1296   - * with MEMORY_HOTPLUG.
  1296 + * Struct page scanning for each node.
1297 1297 */
  1298 + lock_memory_hotplug();
1298 1299 for_each_online_node(i) {
1299 1300 pg_data_t *pgdat = NODE_DATA(i);
1300 1301 unsigned long start_pfn = pgdat->node_start_pfn;
... ... @@ -1313,6 +1314,7 @@
1313 1314 scan_block(page, page + 1, NULL, 1);
1314 1315 }
1315 1316 }
  1317 + unlock_memory_hotplug();
1316 1318  
1317 1319 /*
1318 1320 * Scanning the task stacks (may introduce false negatives).