linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] kmemleak: Add support for memory hotplug
@ 2011-11-15 23:49 Laura Abbott
  2011-11-15 23:49 ` Laura Abbott
  0 siblings, 1 reply; 3+ messages in thread
From: Laura Abbott @ 2011-11-15 23:49 UTC (permalink / raw)
  To: catalin.marinas, mingo; +Cc: linux-kernel, linux-mm, linux-arm-msm

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 majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [RFC PATCH] kmemleak: Add support for memory hotplug
  2011-11-15 23:49 [RFC PATCH] kmemleak: Add support for memory hotplug Laura Abbott
@ 2011-11-15 23:49 ` Laura Abbott
  2011-11-17 17:57   ` Catalin Marinas
  0 siblings, 1 reply; 3+ messages in thread
From: Laura Abbott @ 2011-11-15 23:49 UTC (permalink / raw)
  To: catalin.marinas, mingo
  Cc: linux-kernel, linux-mm, linux-arm-msm, Laura Abbott

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>
---
 lib/Kconfig.debug |    2 +-
 mm/kmemleak.c     |    6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index c6b006a..6a9e368 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -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
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index aacee45..4facb03 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -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).
-- 
1.7.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] kmemleak: Add support for memory hotplug
  2011-11-15 23:49 ` Laura Abbott
@ 2011-11-17 17:57   ` Catalin Marinas
  0 siblings, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2011-11-17 17:57 UTC (permalink / raw)
  To: Laura Abbott
  Cc: mingo@elte.hu, linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-arm-msm@vger.kernel.org

On Tue, Nov 15, 2011 at 11:49:09PM +0000, Laura Abbott wrote:
> 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>

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

-- 
Catalin

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-17 17:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-15 23:49 [RFC PATCH] kmemleak: Add support for memory hotplug Laura Abbott
2011-11-15 23:49 ` Laura Abbott
2011-11-17 17:57   ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).