Skip to content

Commit 029aeff

Browse files
labbottctmarinas
authored andcommitted
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>
1 parent f528f0b commit 029aeff

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎lib/Kconfig.debug‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ config SLUB_STATS
414414

415415
config DEBUG_KMEMLEAK
416416
bool "Kernel memory leak detector"
417-
depends on DEBUG_KERNEL && EXPERIMENTAL && !MEMORY_HOTPLUG && \
417+
depends on DEBUG_KERNEL && EXPERIMENTAL && \
418418
(X86 || ARM || PPC || MIPS || S390 || SPARC64 || SUPERH || MICROBLAZE || TILE)
419419

420420
select DEBUG_FS

‎mm/kmemleak.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100

101101
#include <linux/kmemcheck.h>
102102
#include <linux/kmemleak.h>
103+
#include <linux/memory_hotplug.h>
103104

104105
/*
105106
* Kmemleak configuration and common defines.
@@ -1292,9 +1293,9 @@ static void kmemleak_scan(void)
12921293
#endif
12931294

12941295
/*
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.
12971297
*/
1298+
lock_memory_hotplug();
12981299
for_each_online_node(i) {
12991300
pg_data_t *pgdat = NODE_DATA(i);
13001301
unsigned long start_pfn = pgdat->node_start_pfn;
@@ -1313,6 +1314,7 @@ static void kmemleak_scan(void)
13131314
scan_block(page, page + 1, NULL, 1);
13141315
}
13151316
}
1317+
unlock_memory_hotplug();
13161318

13171319
/*
13181320
* Scanning the task stacks (may introduce false negatives).

0 commit comments

Comments
 (0)