Skip to contentSkip to conversation

kmemleak: Add support for memory hotplug

RFC PATCH New Laura Abbott 2 participants 3 messages Nov 15, 2011 – Nov 17, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 kmemleak: Add support for memory hotplug

Currently, kmemleak is not supported with memory hotplug. This has been discussed before[1] but never really went anywhere. Catalin's other suggestion was to add callbacks for memory hotplug but given there is now a nice lock_memory_hotplug function, this seems like the right place to call it. Down the road call backs could be added but this should hopefully enable hotplug to be used with kmemleak.

-Laura

[1] https://lkml.org/lkml/2010/3/22/395

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw

RFC PATCH 1/1 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.

---
 lib/Kconfig.debug |    2 +-
 mm/kmemleak.c     |    6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
lib/Kconfig.debug +1 -1
index c6b006a..6a9e368 100644
@@ -413,7 +413,7 @@ config SLUB_STATS
 
 config DEBUG_KMEMLEAK
 	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)
 
 	select DEBUG_FS
mm/kmemleak.c +4 -2
index aacee45..4facb03 100644
@@ -100,6 +100,7 @@
 
 #include <linux/kmemcheck.h>
 #include <linux/kmemleak.h>
+#include <linux/memory_hotplug.h>
 
 /*
  * Kmemleak configuration and common defines.
@@ -1220,9 +1221,9 @@ static void kmemleak_scan(void)
 #endif
 
 	/*
-	 * Struct page scanning for each node. The code below is not yet safe
-	 * with MEMORY_HOTPLUG.
+	 * Struct page scanning for each node.
 	 */
+	lock_memory_hotplug();
 	for_each_online_node(i) {
 		pg_data_t *pgdat = NODE_DATA(i);
 		unsigned long start_pfn = pgdat->node_start_pfn;
@@ -1241,6 +1242,7 @@ static void kmemleak_scan(void)
 			scan_block(page, page + 1, NULL, 1);
 		}
 	}
+	unlock_memory_hotplug();
 
 	/*
 	 * Scanning the task stacks (may introduce false negatives).
Signature · 1 line
1.7.6
maintainer
#2 lore raw
Quoted 5 lines · Laura Abbott

Ensure that memory hotplug can co-exist with kmemleak by taking the hotplug lock before scanning the memory banks.

Thanks, the patch looks fine to me. I'll add it to my kmemleak branch for the next merging window.

Signature · 8 lines
Catalin

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>