All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] Expand memblock=debug to provide a bit more details (v1).
@ 2012-05-04 18:49 ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 11+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-05-04 18:49 UTC (permalink / raw)
  To: linux-kernel, tj, hpa, yinghai, paul.gortmaker, akpm, linux-mm

While trying to track down some memory allocation issues, I realized that
memblock=debug was giving some information, but for guests with 256GB or
so the majority of it was just:

 memblock_reserve: [0x00003efeeea000-0x00003efeeeb000] __alloc_memory_core_early+0x5c/0x64

which really didn't tell me that much. With these patches I know it is:

 memblock_reserve: [0x00003ffe724000-0x00003ffe725000] (4kB) vmemmap_pmd_populate+0x4b/0xa2

.. which isn't really that useful for the problem I was tracking down, but
it does help in figuring out which routines are using memblock.

Please see the patches - not sure what is in the future for memblock.c
so if they are running afoul of some future grand plans - I can rebase them.

Thanks!

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

* [RFC PATCH] Expand memblock=debug to provide a bit more details (v1).
@ 2012-05-04 18:49 ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 11+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-05-04 18:49 UTC (permalink / raw)
  To: linux-kernel, tj, hpa, yinghai, paul.gortmaker, akpm, linux-mm

While trying to track down some memory allocation issues, I realized that
memblock=debug was giving some information, but for guests with 256GB or
so the majority of it was just:

 memblock_reserve: [0x00003efeeea000-0x00003efeeeb000] __alloc_memory_core_early+0x5c/0x64

which really didn't tell me that much. With these patches I know it is:

 memblock_reserve: [0x00003ffe724000-0x00003ffe725000] (4kB) vmemmap_pmd_populate+0x4b/0xa2

.. which isn't really that useful for the problem I was tracking down, but
it does help in figuring out which routines are using memblock.

Please see the patches - not sure what is in the future for memblock.c
so if they are running afoul of some future grand plans - I can rebase them.

Thanks!

--
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] 11+ messages in thread

* [PATCH 1/2] memblock: Add _THIS_IP off the caller to memblock debug statements and size in kB.
  2012-05-04 18:49 ` Konrad Rzeszutek Wilk
@ 2012-05-04 18:49   ` Konrad Rzeszutek Wilk
  -1 siblings, 0 replies; 11+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-05-04 18:49 UTC (permalink / raw)
  To: linux-kernel, tj, hpa, yinghai, paul.gortmaker, akpm, linux-mm
  Cc: Konrad Rzeszutek Wilk

-memblock_reserve: [0x0000003fefb000-0x0000003fefc000] (4kB) __alloc_memory_core_early+0x65/0x70
-memblock_reserve: [0x0000003fafb000-0x0000003fefb000] (4096kB) __alloc_memory_core_early+0x65/0x70
-memblock_reserve: [0x0000003fafaf00-0x0000003fafafd8] (0kB) __alloc_memory_core_early+0x65/0x70
-memblock_reserve: [0x0000003f6faf00-0x0000003fafaf00] (4096kB) __alloc_memory_core_early+0x65/0x70
-memblock_reserve: [0x0000003e400000-0x0000003f600000] (18432kB) __alloc_memory_core_early+0x65/0x70
-memblock_reserve: [0x0000003f6f9000-0x0000003f6fa000] (4kB) __alloc_memory_core_early+0x65/0x70
.. snip..
-   memblock_free: [0x0000003f3c0000-0x0000003f600000] (2304kB) free_bootmem+0xd/0xf
-   memblock_free: [0x0000003f6faf00-0x0000003fafaf00] (4096kB) free_bootmem+0xd/0xf
-   memblock_free: [0x0000003fafb000-0x0000003fefb000] (4096kB) free_bootmem+0xd/0xf
+memblock_reserve: [0x0000003fefb000-0x0000003fefc000] __alloc_memory_core_early+0x5c/0x64
+memblock_reserve: [0x0000003fafb000-0x0000003fefb000] __alloc_memory_core_early+0x5c/0x64
+memblock_reserve: [0x0000003fafaf00-0x0000003fafafd8] __alloc_memory_core_early+0x5c/0x64
+memblock_reserve: [0x0000003f6faf00-0x0000003fafaf00] __alloc_memory_core_early+0x5c/0x64
+memblock_reserve: [0x0000003e400000-0x0000003f600000] __alloc_memory_core_early+0x5c/0x64
.. snip..
+   memblock_free: [0x0000003f3c0000-0x0000003f600000] free_bootmem+0x9/0xb
+   memblock_free: [0x0000003f6faf00-0x0000003fafaf00] free_bootmem+0x9/0xb
+   memblock_free: [0x0000003fafb000-0x0000003fefb000] free_bootmem+0x9/0xb

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 include/linux/memblock.h |    6 +++-
 mm/memblock.c            |   14 +++++++-----
 mm/nobootmem.c           |   50 ++++++++++++++++++++++++++-------------------
 3 files changed, 41 insertions(+), 29 deletions(-)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index a6bb102..2a1ec82 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -57,8 +57,10 @@ void memblock_allow_resize(void);
 int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid);
 int memblock_add(phys_addr_t base, phys_addr_t size);
 int memblock_remove(phys_addr_t base, phys_addr_t size);
-int memblock_free(phys_addr_t base, phys_addr_t size);
-int memblock_reserve(phys_addr_t base, phys_addr_t size);
+int __memblock_free(phys_addr_t base, phys_addr_t size, void *caller);
+#define memblock_free(base, size) __memblock_free(base, size, (void *)_RET_IP_)
+int __memblock_reserve(phys_addr_t base, phys_addr_t size, void *caller);
+#define memblock_reserve(base, size) __memblock_reserve(base, size, (void *)_RET_IP_)
 
 #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
 void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
diff --git a/mm/memblock.c b/mm/memblock.c
index a44eab3..3e97b07 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -502,24 +502,26 @@ int __init_memblock memblock_remove(phys_addr_t base, phys_addr_t size)
 	return __memblock_remove(&memblock.memory, base, size);
 }
 
-int __init_memblock memblock_free(phys_addr_t base, phys_addr_t size)
+int __init_memblock __memblock_free(phys_addr_t base, phys_addr_t size, void *caller)
 {
-	memblock_dbg("   memblock_free: [%#016llx-%#016llx] %pF\n",
+	memblock_dbg("   memblock_free: [%#016llx-%#016llx] (%lukB) %pF\n",
 		     (unsigned long long)base,
 		     (unsigned long long)base + size,
-		     (void *)_RET_IP_);
+		     (unsigned long)(size >> 10),
+		     caller);
 
 	return __memblock_remove(&memblock.reserved, base, size);
 }
 
-int __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size)
+int __init_memblock __memblock_reserve(phys_addr_t base, phys_addr_t size, void *caller)
 {
 	struct memblock_type *_rgn = &memblock.reserved;
 
-	memblock_dbg("memblock_reserve: [%#016llx-%#016llx] %pF\n",
+	memblock_dbg("memblock_reserve: [%#016llx-%#016llx] (%lukB) %pF\n",
 		     (unsigned long long)base,
 		     (unsigned long long)base + size,
-		     (void *)_RET_IP_);
+		     (unsigned long)(size >> 10),
+		     caller);
 
 	return memblock_add_region(_rgn, base, size, MAX_NUMNODES);
 }
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index e53bb8a..fe9b251 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -16,6 +16,7 @@
 #include <linux/kmemleak.h>
 #include <linux/range.h>
 #include <linux/memblock.h>
+#include <linux/kernel.h>
 
 #include <asm/bug.h>
 #include <asm/io.h>
@@ -33,7 +34,7 @@ unsigned long min_low_pfn;
 unsigned long max_pfn;
 
 static void * __init __alloc_memory_core_early(int nid, u64 size, u64 align,
-					u64 goal, u64 limit)
+					u64 goal, u64 limit, void *caller)
 {
 	void *ptr;
 	u64 addr;
@@ -47,7 +48,7 @@ static void * __init __alloc_memory_core_early(int nid, u64 size, u64 align,
 
 	ptr = phys_to_virt(addr);
 	memset(ptr, 0, size);
-	memblock_reserve(addr, size);
+	__memblock_reserve(addr, size, caller);
 	/*
 	 * The min_count is set to 0 so that bootmem allocated blocks
 	 * are never reported as leaks.
@@ -175,7 +176,7 @@ void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
 			      unsigned long size)
 {
 	kmemleak_free_part(__va(physaddr), size);
-	memblock_free(physaddr, size);
+	__memblock_free(physaddr, size, (void *)_RET_IP_);
 }
 
 /**
@@ -190,13 +191,14 @@ void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
 void __init free_bootmem(unsigned long addr, unsigned long size)
 {
 	kmemleak_free_part(__va(addr), size);
-	memblock_free(addr, size);
+	__memblock_free(addr, size, (void *)_RET_IP_);
 }
 
 static void * __init ___alloc_bootmem_nopanic(unsigned long size,
 					unsigned long align,
 					unsigned long goal,
-					unsigned long limit)
+					unsigned long limit,
+					void *caller)
 {
 	void *ptr;
 
@@ -205,7 +207,7 @@ static void * __init ___alloc_bootmem_nopanic(unsigned long size,
 
 restart:
 
-	ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align, goal, limit);
+	ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align, goal, limit, caller);
 
 	if (ptr)
 		return ptr;
@@ -236,13 +238,14 @@ void * __init __alloc_bootmem_nopanic(unsigned long size, unsigned long align,
 {
 	unsigned long limit = -1UL;
 
-	return ___alloc_bootmem_nopanic(size, align, goal, limit);
+	return ___alloc_bootmem_nopanic(size, align, goal, limit, (void *)_RET_IP_);
 }
 
 static void * __init ___alloc_bootmem(unsigned long size, unsigned long align,
-					unsigned long goal, unsigned long limit)
+					unsigned long goal, unsigned long limit,
+					void *caller)
 {
-	void *mem = ___alloc_bootmem_nopanic(size, align, goal, limit);
+	void *mem = ___alloc_bootmem_nopanic(size, align, goal, limit, caller);
 
 	if (mem)
 		return mem;
@@ -271,8 +274,7 @@ void * __init __alloc_bootmem(unsigned long size, unsigned long align,
 			      unsigned long goal)
 {
 	unsigned long limit = -1UL;
-
-	return ___alloc_bootmem(size, align, goal, limit);
+	return ___alloc_bootmem(size, align, goal, limit, (void *)_RET_IP_);
 }
 
 /**
@@ -290,8 +292,9 @@ void * __init __alloc_bootmem(unsigned long size, unsigned long align,
  *
  * The function panics if the request can not be satisfied.
  */
-void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
-				   unsigned long align, unsigned long goal)
+void * __init ____alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
+				     unsigned long align, unsigned long goal,
+				     void *caller)
 {
 	void *ptr;
 
@@ -300,23 +303,28 @@ void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
 
 again:
 	ptr = __alloc_memory_core_early(pgdat->node_id, size, align,
-					 goal, -1ULL);
+					 goal, -1ULL, caller);
 	if (ptr)
 		return ptr;
 
 	ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align,
-					goal, -1ULL);
+					goal, -1ULL, caller);
 	if (!ptr && goal) {
 		goal = 0;
 		goto again;
 	}
 	return ptr;
 }
+void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
+				   unsigned long align, unsigned long goal)
+{
+	return ____alloc_bootmem_node(pgdat, size, align, goal, (void *)_RET_IP_);
+}
 
 void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size,
 				   unsigned long align, unsigned long goal)
 {
-	return __alloc_bootmem_node(pgdat, size, align, goal);
+	return ____alloc_bootmem_node(pgdat, size, align, goal, (void *)_RET_IP_);
 }
 
 #ifdef CONFIG_SPARSEMEM
@@ -337,7 +345,7 @@ void * __init alloc_bootmem_section(unsigned long size,
 	limit = section_nr_to_pfn(section_nr + 1) << PAGE_SHIFT;
 
 	return __alloc_memory_core_early(early_pfn_to_nid(pfn), size,
-					 SMP_CACHE_BYTES, goal, limit);
+					 SMP_CACHE_BYTES, goal, limit, (void *)_RET_IP_);
 }
 #endif
 
@@ -350,7 +358,7 @@ void * __init __alloc_bootmem_node_nopanic(pg_data_t *pgdat, unsigned long size,
 		return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
 
 	ptr =  __alloc_memory_core_early(pgdat->node_id, size, align,
-						 goal, -1ULL);
+						 goal, -1ULL, (void *)_RET_IP_);
 	if (ptr)
 		return ptr;
 
@@ -377,7 +385,7 @@ void * __init __alloc_bootmem_node_nopanic(pg_data_t *pgdat, unsigned long size,
 void * __init __alloc_bootmem_low(unsigned long size, unsigned long align,
 				  unsigned long goal)
 {
-	return ___alloc_bootmem(size, align, goal, ARCH_LOW_ADDRESS_LIMIT);
+	return ___alloc_bootmem(size, align, goal, ARCH_LOW_ADDRESS_LIMIT, (void *)_RET_IP_);
 }
 
 /**
@@ -404,10 +412,10 @@ void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, unsigned long size,
 		return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
 
 	ptr = __alloc_memory_core_early(pgdat->node_id, size, align,
-				goal, ARCH_LOW_ADDRESS_LIMIT);
+				goal, ARCH_LOW_ADDRESS_LIMIT, (void *)_RET_IP_);
 	if (ptr)
 		return ptr;
 
 	return  __alloc_memory_core_early(MAX_NUMNODES, size, align,
-				goal, ARCH_LOW_ADDRESS_LIMIT);
+				goal, ARCH_LOW_ADDRESS_LIMIT, (void *)_RET_IP_);
 }
-- 
1.7.7.5


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

* [PATCH 1/2] memblock: Add _THIS_IP off the caller to memblock debug statements and size in kB.
@ 2012-05-04 18:49   ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 11+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-05-04 18:49 UTC (permalink / raw)
  To: linux-kernel, tj, hpa, yinghai, paul.gortmaker, akpm, linux-mm
  Cc: Konrad Rzeszutek Wilk

-memblock_reserve: [0x0000003fefb000-0x0000003fefc000] (4kB) __alloc_memory_core_early+0x65/0x70
-memblock_reserve: [0x0000003fafb000-0x0000003fefb000] (4096kB) __alloc_memory_core_early+0x65/0x70
-memblock_reserve: [0x0000003fafaf00-0x0000003fafafd8] (0kB) __alloc_memory_core_early+0x65/0x70
-memblock_reserve: [0x0000003f6faf00-0x0000003fafaf00] (4096kB) __alloc_memory_core_early+0x65/0x70
-memblock_reserve: [0x0000003e400000-0x0000003f600000] (18432kB) __alloc_memory_core_early+0x65/0x70
-memblock_reserve: [0x0000003f6f9000-0x0000003f6fa000] (4kB) __alloc_memory_core_early+0x65/0x70
.. snip..
-   memblock_free: [0x0000003f3c0000-0x0000003f600000] (2304kB) free_bootmem+0xd/0xf
-   memblock_free: [0x0000003f6faf00-0x0000003fafaf00] (4096kB) free_bootmem+0xd/0xf
-   memblock_free: [0x0000003fafb000-0x0000003fefb000] (4096kB) free_bootmem+0xd/0xf
+memblock_reserve: [0x0000003fefb000-0x0000003fefc000] __alloc_memory_core_early+0x5c/0x64
+memblock_reserve: [0x0000003fafb000-0x0000003fefb000] __alloc_memory_core_early+0x5c/0x64
+memblock_reserve: [0x0000003fafaf00-0x0000003fafafd8] __alloc_memory_core_early+0x5c/0x64
+memblock_reserve: [0x0000003f6faf00-0x0000003fafaf00] __alloc_memory_core_early+0x5c/0x64
+memblock_reserve: [0x0000003e400000-0x0000003f600000] __alloc_memory_core_early+0x5c/0x64
.. snip..
+   memblock_free: [0x0000003f3c0000-0x0000003f600000] free_bootmem+0x9/0xb
+   memblock_free: [0x0000003f6faf00-0x0000003fafaf00] free_bootmem+0x9/0xb
+   memblock_free: [0x0000003fafb000-0x0000003fefb000] free_bootmem+0x9/0xb

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 include/linux/memblock.h |    6 +++-
 mm/memblock.c            |   14 +++++++-----
 mm/nobootmem.c           |   50 ++++++++++++++++++++++++++-------------------
 3 files changed, 41 insertions(+), 29 deletions(-)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index a6bb102..2a1ec82 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -57,8 +57,10 @@ void memblock_allow_resize(void);
 int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid);
 int memblock_add(phys_addr_t base, phys_addr_t size);
 int memblock_remove(phys_addr_t base, phys_addr_t size);
-int memblock_free(phys_addr_t base, phys_addr_t size);
-int memblock_reserve(phys_addr_t base, phys_addr_t size);
+int __memblock_free(phys_addr_t base, phys_addr_t size, void *caller);
+#define memblock_free(base, size) __memblock_free(base, size, (void *)_RET_IP_)
+int __memblock_reserve(phys_addr_t base, phys_addr_t size, void *caller);
+#define memblock_reserve(base, size) __memblock_reserve(base, size, (void *)_RET_IP_)
 
 #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
 void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
diff --git a/mm/memblock.c b/mm/memblock.c
index a44eab3..3e97b07 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -502,24 +502,26 @@ int __init_memblock memblock_remove(phys_addr_t base, phys_addr_t size)
 	return __memblock_remove(&memblock.memory, base, size);
 }
 
-int __init_memblock memblock_free(phys_addr_t base, phys_addr_t size)
+int __init_memblock __memblock_free(phys_addr_t base, phys_addr_t size, void *caller)
 {
-	memblock_dbg("   memblock_free: [%#016llx-%#016llx] %pF\n",
+	memblock_dbg("   memblock_free: [%#016llx-%#016llx] (%lukB) %pF\n",
 		     (unsigned long long)base,
 		     (unsigned long long)base + size,
-		     (void *)_RET_IP_);
+		     (unsigned long)(size >> 10),
+		     caller);
 
 	return __memblock_remove(&memblock.reserved, base, size);
 }
 
-int __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size)
+int __init_memblock __memblock_reserve(phys_addr_t base, phys_addr_t size, void *caller)
 {
 	struct memblock_type *_rgn = &memblock.reserved;
 
-	memblock_dbg("memblock_reserve: [%#016llx-%#016llx] %pF\n",
+	memblock_dbg("memblock_reserve: [%#016llx-%#016llx] (%lukB) %pF\n",
 		     (unsigned long long)base,
 		     (unsigned long long)base + size,
-		     (void *)_RET_IP_);
+		     (unsigned long)(size >> 10),
+		     caller);
 
 	return memblock_add_region(_rgn, base, size, MAX_NUMNODES);
 }
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index e53bb8a..fe9b251 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -16,6 +16,7 @@
 #include <linux/kmemleak.h>
 #include <linux/range.h>
 #include <linux/memblock.h>
+#include <linux/kernel.h>
 
 #include <asm/bug.h>
 #include <asm/io.h>
@@ -33,7 +34,7 @@ unsigned long min_low_pfn;
 unsigned long max_pfn;
 
 static void * __init __alloc_memory_core_early(int nid, u64 size, u64 align,
-					u64 goal, u64 limit)
+					u64 goal, u64 limit, void *caller)
 {
 	void *ptr;
 	u64 addr;
@@ -47,7 +48,7 @@ static void * __init __alloc_memory_core_early(int nid, u64 size, u64 align,
 
 	ptr = phys_to_virt(addr);
 	memset(ptr, 0, size);
-	memblock_reserve(addr, size);
+	__memblock_reserve(addr, size, caller);
 	/*
 	 * The min_count is set to 0 so that bootmem allocated blocks
 	 * are never reported as leaks.
@@ -175,7 +176,7 @@ void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
 			      unsigned long size)
 {
 	kmemleak_free_part(__va(physaddr), size);
-	memblock_free(physaddr, size);
+	__memblock_free(physaddr, size, (void *)_RET_IP_);
 }
 
 /**
@@ -190,13 +191,14 @@ void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
 void __init free_bootmem(unsigned long addr, unsigned long size)
 {
 	kmemleak_free_part(__va(addr), size);
-	memblock_free(addr, size);
+	__memblock_free(addr, size, (void *)_RET_IP_);
 }
 
 static void * __init ___alloc_bootmem_nopanic(unsigned long size,
 					unsigned long align,
 					unsigned long goal,
-					unsigned long limit)
+					unsigned long limit,
+					void *caller)
 {
 	void *ptr;
 
@@ -205,7 +207,7 @@ static void * __init ___alloc_bootmem_nopanic(unsigned long size,
 
 restart:
 
-	ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align, goal, limit);
+	ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align, goal, limit, caller);
 
 	if (ptr)
 		return ptr;
@@ -236,13 +238,14 @@ void * __init __alloc_bootmem_nopanic(unsigned long size, unsigned long align,
 {
 	unsigned long limit = -1UL;
 
-	return ___alloc_bootmem_nopanic(size, align, goal, limit);
+	return ___alloc_bootmem_nopanic(size, align, goal, limit, (void *)_RET_IP_);
 }
 
 static void * __init ___alloc_bootmem(unsigned long size, unsigned long align,
-					unsigned long goal, unsigned long limit)
+					unsigned long goal, unsigned long limit,
+					void *caller)
 {
-	void *mem = ___alloc_bootmem_nopanic(size, align, goal, limit);
+	void *mem = ___alloc_bootmem_nopanic(size, align, goal, limit, caller);
 
 	if (mem)
 		return mem;
@@ -271,8 +274,7 @@ void * __init __alloc_bootmem(unsigned long size, unsigned long align,
 			      unsigned long goal)
 {
 	unsigned long limit = -1UL;
-
-	return ___alloc_bootmem(size, align, goal, limit);
+	return ___alloc_bootmem(size, align, goal, limit, (void *)_RET_IP_);
 }
 
 /**
@@ -290,8 +292,9 @@ void * __init __alloc_bootmem(unsigned long size, unsigned long align,
  *
  * The function panics if the request can not be satisfied.
  */
-void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
-				   unsigned long align, unsigned long goal)
+void * __init ____alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
+				     unsigned long align, unsigned long goal,
+				     void *caller)
 {
 	void *ptr;
 
@@ -300,23 +303,28 @@ void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
 
 again:
 	ptr = __alloc_memory_core_early(pgdat->node_id, size, align,
-					 goal, -1ULL);
+					 goal, -1ULL, caller);
 	if (ptr)
 		return ptr;
 
 	ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align,
-					goal, -1ULL);
+					goal, -1ULL, caller);
 	if (!ptr && goal) {
 		goal = 0;
 		goto again;
 	}
 	return ptr;
 }
+void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
+				   unsigned long align, unsigned long goal)
+{
+	return ____alloc_bootmem_node(pgdat, size, align, goal, (void *)_RET_IP_);
+}
 
 void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size,
 				   unsigned long align, unsigned long goal)
 {
-	return __alloc_bootmem_node(pgdat, size, align, goal);
+	return ____alloc_bootmem_node(pgdat, size, align, goal, (void *)_RET_IP_);
 }
 
 #ifdef CONFIG_SPARSEMEM
@@ -337,7 +345,7 @@ void * __init alloc_bootmem_section(unsigned long size,
 	limit = section_nr_to_pfn(section_nr + 1) << PAGE_SHIFT;
 
 	return __alloc_memory_core_early(early_pfn_to_nid(pfn), size,
-					 SMP_CACHE_BYTES, goal, limit);
+					 SMP_CACHE_BYTES, goal, limit, (void *)_RET_IP_);
 }
 #endif
 
@@ -350,7 +358,7 @@ void * __init __alloc_bootmem_node_nopanic(pg_data_t *pgdat, unsigned long size,
 		return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
 
 	ptr =  __alloc_memory_core_early(pgdat->node_id, size, align,
-						 goal, -1ULL);
+						 goal, -1ULL, (void *)_RET_IP_);
 	if (ptr)
 		return ptr;
 
@@ -377,7 +385,7 @@ void * __init __alloc_bootmem_node_nopanic(pg_data_t *pgdat, unsigned long size,
 void * __init __alloc_bootmem_low(unsigned long size, unsigned long align,
 				  unsigned long goal)
 {
-	return ___alloc_bootmem(size, align, goal, ARCH_LOW_ADDRESS_LIMIT);
+	return ___alloc_bootmem(size, align, goal, ARCH_LOW_ADDRESS_LIMIT, (void *)_RET_IP_);
 }
 
 /**
@@ -404,10 +412,10 @@ void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, unsigned long size,
 		return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
 
 	ptr = __alloc_memory_core_early(pgdat->node_id, size, align,
-				goal, ARCH_LOW_ADDRESS_LIMIT);
+				goal, ARCH_LOW_ADDRESS_LIMIT, (void *)_RET_IP_);
 	if (ptr)
 		return ptr;
 
 	return  __alloc_memory_core_early(MAX_NUMNODES, size, align,
-				goal, ARCH_LOW_ADDRESS_LIMIT);
+				goal, ARCH_LOW_ADDRESS_LIMIT, (void *)_RET_IP_);
 }
-- 
1.7.7.5

--
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 related	[flat|nested] 11+ messages in thread

* [PATCH 2/2] bootmem/sparsemem: Have a new __alloc_bootmem_node_high
  2012-05-04 18:49 ` Konrad Rzeszutek Wilk
@ 2012-05-04 18:49   ` Konrad Rzeszutek Wilk
  -1 siblings, 0 replies; 11+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-05-04 18:49 UTC (permalink / raw)
  To: linux-kernel, tj, hpa, yinghai, paul.gortmaker, akpm, linux-mm
  Cc: Konrad Rzeszutek Wilk

called "__alloc_bootmem_node_high_caller" which will allow to pass
the IP of the caller. The particular user is sparse vmemmap:

 memblock_reserve: [0x0000003fafb000-0x0000003fefb000] (4096kB) sparse_init+0x25/0x272
 memblock_reserve: [0x0000003fafaf00-0x0000003fafafd8] (0kB) sparse_early_usemaps_alloc_node+0x34/0x7d
 memblock_reserve: [0x0000003f6faf00-0x0000003fafaf00] (4096kB) sparse_init+0x104/0x272
-memblock_reserve: [0x0000003e400000-0x0000003f600000] (18432kB) sparse_mem_maps_populate_node+0x46/0x138
-memblock_reserve: [0x0000003f6f9000-0x0000003f6fa000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f8000-0x0000003f6f9000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f7000-0x0000003f6f8000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f6000-0x0000003f6f7000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f5000-0x0000003f6f6000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f4000-0x0000003f6f5000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f3000-0x0000003f6f4000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f2000-0x0000003f6f3000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f1000-0x0000003f6f2000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f0000-0x0000003f6f1000] (4kB) vmemmap_alloc_block+0xde/0xe3
-   memblock_free: [0x0000003f3c0000-0x0000003f600000] (2304kB) sparse_mem_maps_populate_node+0x113/0x138
+memblock_reserve: [0x0000003e400000-0x0000003f600000] (18432kB) sparse_mem_maps_populate_node+0x0/0x13f
+memblock_reserve: [0x0000003f6f9000-0x0000003f6fa000] (4kB) vmemmap_pgd_populate+0x2b/0x82
+memblock_reserve: [0x0000003f6f8000-0x0000003f6f9000] (4kB) vmemmap_pud_populate+0x4b/0xa2
+memblock_reserve: [0x0000003f6f7000-0x0000003f6f8000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
+memblock_reserve: [0x0000003f6f6000-0x0000003f6f7000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
+memblock_reserve: [0x0000003f6f5000-0x0000003f6f6000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
+memblock_reserve: [0x0000003f6f4000-0x0000003f6f5000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
+memblock_reserve: [0x0000003f6f3000-0x0000003f6f4000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
+memblock_reserve: [0x0000003f6f2000-0x0000003f6f3000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
+memblock_reserve: [0x0000003f6f1000-0x0000003f6f2000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
+memblock_reserve: [0x0000003f6f0000-0x0000003f6f1000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
+   memblock_free: [0x0000003f3c0000-0x0000003f600000] (2304kB) sparse_mem_maps_populate_node+0x11a/0x13f
    memblock_free: [0x0000003f6faf00-0x0000003fafaf00] (4096kB) sparse_init+0x24e/0x272
    memblock_free: [0x0000003fafb000-0x0000003fefb000] (4096kB) sparse_init+0x263/0x272

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 include/linux/bootmem.h |    5 +++++
 mm/bootmem.c            |    7 ++++++-
 mm/nobootmem.c          |    6 ++++++
 mm/sparse-vmemmap.c     |    9 +++++----
 4 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 66d3e95..4c4ed3b 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -87,6 +87,11 @@ void *__alloc_bootmem_node_high(pg_data_t *pgdat,
 				  unsigned long size,
 				  unsigned long align,
 				  unsigned long goal);
+void *__alloc_bootmem_node_high_caller(pg_data_t *pgdat,
+				       unsigned long size,
+				       unsigned long align,
+				       unsigned long goal,
+				       void *caller);
 extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat,
 				  unsigned long size,
 				  unsigned long align,
diff --git a/mm/bootmem.c b/mm/bootmem.c
index 0131170..89c792b 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -753,7 +753,12 @@ void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size,
 	return __alloc_bootmem_node(pgdat, size, align, goal);
 
 }
-
+void * __init __alloc_bootmem_node_high_caller(pg_data_t *pgdat, unsigned long size,
+					       unsigned long align, unsigned long goal,
+					       void *caller)
+{
+	return __alloc_bootmem_node_high(pgdat, size, align, goal);
+}
 #ifdef CONFIG_SPARSEMEM
 /**
  * alloc_bootmem_section - allocate boot memory from a specific section
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index fe9b251..0acc38e 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -326,6 +326,12 @@ void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size,
 {
 	return ____alloc_bootmem_node(pgdat, size, align, goal, (void *)_RET_IP_);
 }
+void * __init __alloc_bootmem_node_high_caller(pg_data_t *pgdat, unsigned long size,
+					       unsigned long align, unsigned long goal,
+					       void *caller)
+{
+	return ____alloc_bootmem_node(pgdat, size, align, goal, caller);
+}
 
 #ifdef CONFIG_SPARSEMEM
 /**
diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
index 1b7e22a..00e3b2a 100644
--- a/mm/sparse-vmemmap.c
+++ b/mm/sparse-vmemmap.c
@@ -38,9 +38,10 @@
 static void * __init_refok __earlyonly_bootmem_alloc(int node,
 				unsigned long size,
 				unsigned long align,
-				unsigned long goal)
+				unsigned long goal,
+				void *caller)
 {
-	return __alloc_bootmem_node_high(NODE_DATA(node), size, align, goal);
+	return __alloc_bootmem_node_high_caller(NODE_DATA(node), size, align, goal, caller);
 }
 
 static void *vmemmap_buf;
@@ -63,7 +64,7 @@ void * __meminit vmemmap_alloc_block(unsigned long size, int node)
 		return NULL;
 	} else
 		return __earlyonly_bootmem_alloc(node, size, size,
-				__pa(MAX_DMA_ADDRESS));
+				__pa(MAX_DMA_ADDRESS), (void *)_RET_IP_);
 }
 
 /* need to make sure size is all the same during early stage */
@@ -195,7 +196,7 @@ void __init sparse_mem_maps_populate_node(struct page **map_map,
 
 	size = ALIGN(size, PMD_SIZE);
 	vmemmap_buf_start = __earlyonly_bootmem_alloc(nodeid, size * map_count,
-			 PMD_SIZE, __pa(MAX_DMA_ADDRESS));
+			 PMD_SIZE, __pa(MAX_DMA_ADDRESS), (void *)_THIS_IP_);
 
 	if (vmemmap_buf_start) {
 		vmemmap_buf = vmemmap_buf_start;
-- 
1.7.7.5


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

* [PATCH 2/2] bootmem/sparsemem: Have a new __alloc_bootmem_node_high
@ 2012-05-04 18:49   ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 11+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-05-04 18:49 UTC (permalink / raw)
  To: linux-kernel, tj, hpa, yinghai, paul.gortmaker, akpm, linux-mm
  Cc: Konrad Rzeszutek Wilk

called "__alloc_bootmem_node_high_caller" which will allow to pass
the IP of the caller. The particular user is sparse vmemmap:

 memblock_reserve: [0x0000003fafb000-0x0000003fefb000] (4096kB) sparse_init+0x25/0x272
 memblock_reserve: [0x0000003fafaf00-0x0000003fafafd8] (0kB) sparse_early_usemaps_alloc_node+0x34/0x7d
 memblock_reserve: [0x0000003f6faf00-0x0000003fafaf00] (4096kB) sparse_init+0x104/0x272
-memblock_reserve: [0x0000003e400000-0x0000003f600000] (18432kB) sparse_mem_maps_populate_node+0x46/0x138
-memblock_reserve: [0x0000003f6f9000-0x0000003f6fa000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f8000-0x0000003f6f9000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f7000-0x0000003f6f8000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f6000-0x0000003f6f7000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f5000-0x0000003f6f6000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f4000-0x0000003f6f5000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f3000-0x0000003f6f4000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f2000-0x0000003f6f3000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f1000-0x0000003f6f2000] (4kB) vmemmap_alloc_block+0xde/0xe3
-memblock_reserve: [0x0000003f6f0000-0x0000003f6f1000] (4kB) vmemmap_alloc_block+0xde/0xe3
-   memblock_free: [0x0000003f3c0000-0x0000003f600000] (2304kB) sparse_mem_maps_populate_node+0x113/0x138
+memblock_reserve: [0x0000003e400000-0x0000003f600000] (18432kB) sparse_mem_maps_populate_node+0x0/0x13f
+memblock_reserve: [0x0000003f6f9000-0x0000003f6fa000] (4kB) vmemmap_pgd_populate+0x2b/0x82
+memblock_reserve: [0x0000003f6f8000-0x0000003f6f9000] (4kB) vmemmap_pud_populate+0x4b/0xa2
+memblock_reserve: [0x0000003f6f7000-0x0000003f6f8000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
+memblock_reserve: [0x0000003f6f6000-0x0000003f6f7000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
+memblock_reserve: [0x0000003f6f5000-0x0000003f6f6000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
+memblock_reserve: [0x0000003f6f4000-0x0000003f6f5000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
+memblock_reserve: [0x0000003f6f3000-0x0000003f6f4000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
+memblock_reserve: [0x0000003f6f2000-0x0000003f6f3000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
+memblock_reserve: [0x0000003f6f1000-0x0000003f6f2000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
+memblock_reserve: [0x0000003f6f0000-0x0000003f6f1000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
+   memblock_free: [0x0000003f3c0000-0x0000003f600000] (2304kB) sparse_mem_maps_populate_node+0x11a/0x13f
    memblock_free: [0x0000003f6faf00-0x0000003fafaf00] (4096kB) sparse_init+0x24e/0x272
    memblock_free: [0x0000003fafb000-0x0000003fefb000] (4096kB) sparse_init+0x263/0x272

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 include/linux/bootmem.h |    5 +++++
 mm/bootmem.c            |    7 ++++++-
 mm/nobootmem.c          |    6 ++++++
 mm/sparse-vmemmap.c     |    9 +++++----
 4 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 66d3e95..4c4ed3b 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -87,6 +87,11 @@ void *__alloc_bootmem_node_high(pg_data_t *pgdat,
 				  unsigned long size,
 				  unsigned long align,
 				  unsigned long goal);
+void *__alloc_bootmem_node_high_caller(pg_data_t *pgdat,
+				       unsigned long size,
+				       unsigned long align,
+				       unsigned long goal,
+				       void *caller);
 extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat,
 				  unsigned long size,
 				  unsigned long align,
diff --git a/mm/bootmem.c b/mm/bootmem.c
index 0131170..89c792b 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -753,7 +753,12 @@ void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size,
 	return __alloc_bootmem_node(pgdat, size, align, goal);
 
 }
-
+void * __init __alloc_bootmem_node_high_caller(pg_data_t *pgdat, unsigned long size,
+					       unsigned long align, unsigned long goal,
+					       void *caller)
+{
+	return __alloc_bootmem_node_high(pgdat, size, align, goal);
+}
 #ifdef CONFIG_SPARSEMEM
 /**
  * alloc_bootmem_section - allocate boot memory from a specific section
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index fe9b251..0acc38e 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -326,6 +326,12 @@ void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size,
 {
 	return ____alloc_bootmem_node(pgdat, size, align, goal, (void *)_RET_IP_);
 }
+void * __init __alloc_bootmem_node_high_caller(pg_data_t *pgdat, unsigned long size,
+					       unsigned long align, unsigned long goal,
+					       void *caller)
+{
+	return ____alloc_bootmem_node(pgdat, size, align, goal, caller);
+}
 
 #ifdef CONFIG_SPARSEMEM
 /**
diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
index 1b7e22a..00e3b2a 100644
--- a/mm/sparse-vmemmap.c
+++ b/mm/sparse-vmemmap.c
@@ -38,9 +38,10 @@
 static void * __init_refok __earlyonly_bootmem_alloc(int node,
 				unsigned long size,
 				unsigned long align,
-				unsigned long goal)
+				unsigned long goal,
+				void *caller)
 {
-	return __alloc_bootmem_node_high(NODE_DATA(node), size, align, goal);
+	return __alloc_bootmem_node_high_caller(NODE_DATA(node), size, align, goal, caller);
 }
 
 static void *vmemmap_buf;
@@ -63,7 +64,7 @@ void * __meminit vmemmap_alloc_block(unsigned long size, int node)
 		return NULL;
 	} else
 		return __earlyonly_bootmem_alloc(node, size, size,
-				__pa(MAX_DMA_ADDRESS));
+				__pa(MAX_DMA_ADDRESS), (void *)_RET_IP_);
 }
 
 /* need to make sure size is all the same during early stage */
@@ -195,7 +196,7 @@ void __init sparse_mem_maps_populate_node(struct page **map_map,
 
 	size = ALIGN(size, PMD_SIZE);
 	vmemmap_buf_start = __earlyonly_bootmem_alloc(nodeid, size * map_count,
-			 PMD_SIZE, __pa(MAX_DMA_ADDRESS));
+			 PMD_SIZE, __pa(MAX_DMA_ADDRESS), (void *)_THIS_IP_);
 
 	if (vmemmap_buf_start) {
 		vmemmap_buf = vmemmap_buf_start;
-- 
1.7.7.5

--
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 related	[flat|nested] 11+ messages in thread

* Re: [RFC PATCH] Expand memblock=debug to provide a bit more details (v1).
  2012-05-04 18:49 ` Konrad Rzeszutek Wilk
                   ` (2 preceding siblings ...)
  (?)
@ 2012-05-04 19:22 ` Yinghai Lu
  2012-05-04 19:24     ` Konrad Rzeszutek Wilk
  -1 siblings, 1 reply; 11+ messages in thread
From: Yinghai Lu @ 2012-05-04 19:22 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: linux-kernel, tj, hpa, paul.gortmaker, akpm, linux-mm

[-- Attachment #1: Type: text/plain, Size: 873 bytes --]

On Fri, May 4, 2012 at 11:49 AM, Konrad Rzeszutek Wilk
<konrad.wilk@oracle.com> wrote:
> While trying to track down some memory allocation issues, I realized that
> memblock=debug was giving some information, but for guests with 256GB or
> so the majority of it was just:
>
>  memblock_reserve: [0x00003efeeea000-0x00003efeeeb000] __alloc_memory_core_early+0x5c/0x64
>
> which really didn't tell me that much. With these patches I know it is:
>
>  memblock_reserve: [0x00003ffe724000-0x00003ffe725000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
>
> .. which isn't really that useful for the problem I was tracking down, but
> it does help in figuring out which routines are using memblock.
>

that RET_IP is not very helpful for debugging.

Actually I have local debug patch for memblock. please check if that
is going to help debugging.

Thanks

Yinghai

[-- Attachment #2: nobootmem_name_1.patch --]
[-- Type: application/octet-stream, Size: 13143 bytes --]

Subject: [PATCH] x86: Add name for bootmem print out -- part one

So We can get more overview of usages of bootmem.
It is only used when CONFIG_NO_BOOTMEM=y

Signed-off-by: Yinghai <yinghai@kernel.org>

---
 arch/x86/kernel/aperture_64.c |    2 +-
 arch/x86/kernel/check.c       |    2 +-
 arch/x86/kernel/head.c        |    2 +-
 arch/x86/kernel/head32.c      |    6 +++---
 arch/x86/kernel/head64.c      |    6 +++---
 arch/x86/kernel/mpparse.c     |    4 ++--
 arch/x86/kernel/setup.c       |   12 ++++++------
 arch/x86/kernel/trampoline.c  |    2 +-
 arch/x86/mm/init.c            |    2 +-
 arch/x86/mm/memtest.c         |    2 +-
 arch/x86/mm/numa_32.c         |    4 ++--
 arch/x86/mm/numa_emulation.c  |    2 +-
 arch/x86/platform/efi/efi.c   |    4 ++--
 include/linux/memblock.h      |    1 +
 mm/memblock.c                 |   27 +++++++++++++++------------
 15 files changed, 41 insertions(+), 37 deletions(-)

Index: linux-2.6/arch/x86/kernel/aperture_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/aperture_64.c
+++ linux-2.6/arch/x86/kernel/aperture_64.c
@@ -94,7 +94,7 @@ static u32 __init allocate_aperture(void
 				addr, aper_size>>10);
 		return 0;
 	}
-	memblock_reserve(addr, aper_size);
+	__memblock_reserve(addr, aper_size, "aperture64");
 	/*
 	 * Kmemleak should not scan this block as it may not be mapped via the
 	 * kernel direct mapping.
Index: linux-2.6/arch/x86/kernel/check.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/check.c
+++ linux-2.6/arch/x86/kernel/check.c
@@ -91,7 +91,7 @@ void __init setup_bios_corruption_check(
 		if (start >= end)
 			continue;
 
-		memblock_reserve(start, end - start);
+		__memblock_reserve(start, end - start, "SCAN RAM");
 		scan_areas[num_scan_areas].addr = start;
 		scan_areas[num_scan_areas].size = end - start;
 
Index: linux-2.6/arch/x86/kernel/head.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/head.c
+++ linux-2.6/arch/x86/kernel/head.c
@@ -52,7 +52,7 @@ void __init reserve_ebda_region(void)
 		lowmem = 0x9f000;
 
 	/* reserve all memory between lowmem and the 1MB mark */
-	memblock_reserve(lowmem, 0x100000 - lowmem);
+	__memblock_reserve(lowmem, 0x100000 - lowmem, "* BIOS reserved");
 }
 
 void __init setup_early_console(void)
Index: linux-2.6/arch/x86/kernel/head32.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/head32.c
+++ linux-2.6/arch/x86/kernel/head32.c
@@ -33,8 +33,8 @@ void __init i386_start_kernel(void)
 {
 	setup_early_console();
 
-	memblock_reserve(__pa_symbol(&_text),
-			 __pa_symbol(&__bss_stop) - __pa_symbol(&_text));
+	__memblock_reserve(__pa_symbol(&_text),
+			 __pa_symbol(&__bss_stop) - __pa_symbol(&_text), "TEXT DATA BSS");
 
 #ifdef CONFIG_BLK_DEV_INITRD
 	/* Reserve INITRD */
@@ -43,7 +43,7 @@ void __init i386_start_kernel(void)
 		u64 ramdisk_image = boot_params.hdr.ramdisk_image;
 		u64 ramdisk_size  = boot_params.hdr.ramdisk_size;
 		u64 ramdisk_end   = PAGE_ALIGN(ramdisk_image + ramdisk_size);
-		memblock_reserve(ramdisk_image, ramdisk_end - ramdisk_image);
+		__memblock_reserve(ramdisk_image, ramdisk_end - ramdisk_image, "RAMDISK");
 	}
 #endif
 
Index: linux-2.6/arch/x86/kernel/head64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/head64.c
+++ linux-2.6/arch/x86/kernel/head64.c
@@ -109,8 +109,8 @@ void __init x86_64_start_reservations(ch
 		setup_early_console();
 	}
 
-	memblock_reserve(__pa_symbol(&_text),
-			 __pa_symbol(&__bss_stop) - __pa_symbol(&_text));
+	__memblock_reserve(__pa_symbol(&_text),
+			 __pa_symbol(&__bss_stop) - __pa_symbol(&_text), "TEXT DATA BSS");
 
 #ifdef CONFIG_BLK_DEV_INITRD
 	/* Reserve INITRD */
@@ -119,7 +119,7 @@ void __init x86_64_start_reservations(ch
 		unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
 		unsigned long ramdisk_size  = boot_params.hdr.ramdisk_size;
 		unsigned long ramdisk_end   = PAGE_ALIGN(ramdisk_image + ramdisk_size);
-		memblock_reserve(ramdisk_image, ramdisk_end - ramdisk_image);
+		__memblock_reserve(ramdisk_image, ramdisk_end - ramdisk_image, "RAMDISK");
 	}
 #endif
 
Index: linux-2.6/arch/x86/kernel/mpparse.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/mpparse.c
+++ linux-2.6/arch/x86/kernel/mpparse.c
@@ -564,7 +564,7 @@ void __init default_get_smp_config(unsig
 
 static void __init smp_reserve_memory(struct mpf_intel *mpf)
 {
-	memblock_reserve(mpf->physptr, get_mpc_size(mpf->physptr));
+	__memblock_reserve(mpf->physptr, get_mpc_size(mpf->physptr), "* MP-table mpc");
 }
 
 static int __init smp_scan_config(unsigned long base, unsigned long length)
@@ -593,7 +593,7 @@ static int __init smp_scan_config(unsign
 			       mpf, (u64)virt_to_phys(mpf));
 
 			mem = virt_to_phys(mpf);
-			memblock_reserve(mem, sizeof(*mpf));
+			__memblock_reserve(mem, sizeof(*mpf), "* MP-table mpf");
 			if (mpf->physptr)
 				smp_reserve_memory(mpf);
 
Index: linux-2.6/arch/x86/kernel/setup.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup.c
+++ linux-2.6/arch/x86/kernel/setup.c
@@ -305,8 +305,8 @@ static void __init cleanup_highmap(void)
 static void __init reserve_brk(void)
 {
 	if (_brk_end > _brk_start)
-		memblock_reserve(__pa(_brk_start),
-				 __pa(_brk_end) - __pa(_brk_start));
+		__memblock_reserve(__pa(_brk_start),
+				 __pa(_brk_end) - __pa(_brk_start), "BRK");
 
 	/* Mark brk area as locked down and no longer taking any
 	   new allocations */
@@ -337,7 +337,7 @@ static void __init relocate_initrd(void)
 
 	/* Note: this includes all the lowmem currently occupied by
 	   the initrd, we rely on that fact to keep the data intact. */
-	memblock_reserve(ramdisk_here, area_size);
+	__memblock_reserve(ramdisk_here, area_size, "NEW RAMDISK");
 	initrd_start = ramdisk_here + PAGE_OFFSET;
 	initrd_end   = initrd_start + ramdisk_size;
 	printk(KERN_INFO "Allocated new RAMDISK: %08llx - %08llx\n",
@@ -496,7 +496,7 @@ static void __init memblock_x86_reserve_
 	pa_data = boot_params.hdr.setup_data;
 	while (pa_data) {
 		data = early_memremap(pa_data, sizeof(*data));
-		memblock_reserve(pa_data, sizeof(*data) + data->len);
+		__memblock_reserve(pa_data, sizeof(*data) + data->len, "SETUP DATA");
 		pa_data = data->next;
 		early_iounmap(data, sizeof(*data));
 	}
@@ -557,7 +557,7 @@ static void __init reserve_crashkernel(v
 			return;
 		}
 	}
-	memblock_reserve(crash_base, crash_size);
+	__memblock_reserve(crash_base, crash_size, "CRASH KERNEL");
 
 	printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
 			"for crashkernel (System RAM: %ldMB)\n",
@@ -615,7 +615,7 @@ static __init void reserve_ibft_region(v
 	addr = find_ibft_region(&size);
 
 	if (size)
-		memblock_reserve(addr, size);
+		__memblock_reserve(addr, size, "* ibft");
 }
 
 static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;
Index: linux-2.6/arch/x86/kernel/trampoline.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/trampoline.c
+++ linux-2.6/arch/x86/kernel/trampoline.c
@@ -18,7 +18,7 @@ void __init setup_trampolines(void)
 		panic("Cannot allocate trampoline\n");
 
 	x86_trampoline_base = __va(mem);
-	memblock_reserve(mem, size);
+	__memblock_reserve(mem, size, "TRAMPOLINE");
 
 	printk(KERN_DEBUG "Base memory trampoline at [%p] %llx size %zu\n",
 	       x86_trampoline_base, (unsigned long long)mem, size);
Index: linux-2.6/arch/x86/mm/init.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/init.c
+++ linux-2.6/arch/x86/mm/init.c
@@ -121,7 +121,7 @@ static void probe_page_size_mask(void)
 }
 void __init native_pagetable_reserve(u64 start, u64 end)
 {
-	memblock_reserve(start, end - start);
+	__memblock_reserve(start, end - start, "PGTABLE");
 }
 
 #ifdef CONFIG_X86_32
Index: linux-2.6/arch/x86/mm/memtest.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/memtest.c
+++ linux-2.6/arch/x86/mm/memtest.c
@@ -34,7 +34,7 @@ static void __init reserve_bad_mem(u64 p
 	       (unsigned long long) pattern,
 	       (unsigned long long) start_bad,
 	       (unsigned long long) end_bad);
-	memblock_reserve(start_bad, end_bad - start_bad);
+	__memblock_reserve(start_bad, end_bad - start_bad, "BAD RAM");
 }
 
 static void __init memtest(u64 pattern, u64 start_phys, u64 size)
Index: linux-2.6/arch/x86/mm/numa_32.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/numa_32.c
+++ linux-2.6/arch/x86/mm/numa_32.c
@@ -204,7 +204,7 @@ void __init init_alloc_remap(int nid, u6
 			   size, nid);
 		return;
 	}
-	memblock_reserve(node_pa, size);
+	__memblock_reserve(node_pa, size, "KVA RAM");
 
 	remap_pa = memblock_find_in_range(min_low_pfn << PAGE_SHIFT,
 					  max_low_pfn << PAGE_SHIFT,
@@ -215,7 +215,7 @@ void __init init_alloc_remap(int nid, u6
 		memblock_free(node_pa, size);
 		return;
 	}
-	memblock_reserve(remap_pa, size);
+	__memblock_reserve(remap_pa, size, "KVA PG");
 	remap_va = phys_to_virt(remap_pa);
 
 	/* perform actual remap */
Index: linux-2.6/arch/x86/mm/numa_emulation.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/numa_emulation.c
+++ linux-2.6/arch/x86/mm/numa_emulation.c
@@ -361,7 +361,7 @@ void __init numa_emulation(struct numa_m
 			pr_warning("NUMA: Warning: can't allocate copy of distance table, disabling emulation\n");
 			goto no_emu;
 		}
-		memblock_reserve(phys, phys_size);
+		__memblock_reserve(phys, phys_size, "TMP NUMA DIST");
 		phys_dist = __va(phys);
 
 		for (i = 0; i < numa_dist_cnt; i++)
Index: linux-2.6/arch/x86/platform/efi/efi.c
===================================================================
--- linux-2.6.orig/arch/x86/platform/efi/efi.c
+++ linux-2.6/arch/x86/platform/efi/efi.c
@@ -369,7 +369,7 @@ int __init efi_memblock_x86_reserve_rang
 		boot_params.efi_info.efi_memdesc_size;
 	memmap.desc_version = boot_params.efi_info.efi_memdesc_version;
 	memmap.desc_size = boot_params.efi_info.efi_memdesc_size;
-	memblock_reserve(pmap, memmap.nr_map * memmap.desc_size);
+	__memblock_reserve(pmap, memmap.nr_map * memmap.desc_size, "EFI memmap");
 
 	return 0;
 }
@@ -422,7 +422,7 @@ void __init efi_reserve_boot_services(vo
 					"[0x%010llx-0x%010llx]\n",
 						start, start+size-1);
 		} else
-			memblock_reserve(start, size);
+			__memblock_reserve(start, size, "EFI Boot");
 	}
 }
 
Index: linux-2.6/include/linux/memblock.h
===================================================================
--- linux-2.6.orig/include/linux/memblock.h
+++ linux-2.6/include/linux/memblock.h
@@ -60,6 +60,7 @@ int memblock_add(phys_addr_t base, phys_
 int memblock_remove(phys_addr_t base, phys_addr_t size);
 int memblock_free(phys_addr_t base, phys_addr_t size);
 int memblock_reserve(phys_addr_t base, phys_addr_t size);
+int __memblock_reserve(phys_addr_t base, phys_addr_t size, char *name);
 
 #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
 void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
Index: linux-2.6/mm/memblock.c
===================================================================
--- linux-2.6.orig/mm/memblock.c
+++ linux-2.6/mm/memblock.c
@@ -516,25 +516,28 @@ int __init_memblock memblock_free(phys_a
 {
 	WARN_ONCE(!memblock.reserved.max, "memblock.reserved was cleared already!");
 
-	memblock_dbg("   memblock_free: [%#016llx-%#016llx] %pF\n",
+	memblock_dbg("   memblock_free: [%#010llx-%#010llx]",
 		     (unsigned long long)base,
-		     (unsigned long long)base + size,
-		     (void *)_RET_IP_);
+		     (unsigned long long)base + size - 1);
 
 	return __memblock_remove(&memblock.reserved, base, size);
 }
 
-int __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size)
+int __init_memblock __memblock_reserve(phys_addr_t base, phys_addr_t size,
+					char *name)
 {
-	struct memblock_type *_rgn = &memblock.reserved;
-
 	WARN_ONCE(!memblock.reserved.max, "memblock.reserved was cleared already!");
-	memblock_dbg("memblock_reserve: [%#016llx-%#016llx] %pF\n",
-		     (unsigned long long)base,
-		     (unsigned long long)base + size,
-		     (void *)_RET_IP_);
 
-	return memblock_add_region(_rgn, base, size, MAX_NUMNODES);
+	memblock_dbg("memblock_reserve: [%#010llx-%#010llx] %s\n",
+			(unsigned long long)base,
+			(unsigned long long)base + size - 1, name);
+
+	return memblock_add_region(&memblock.reserved, base, size, MAX_NUMNODES);
+}
+
+int __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size)
+{
+	return	__memblock_reserve(base, size, "");
 }
 
 /**
@@ -912,7 +915,7 @@ static void __init_memblock memblock_dum
 			snprintf(nid_buf, sizeof(nid_buf), " on node %d",
 				 memblock_get_region_node(rgn));
 #endif
-		pr_info(" %s[%#x]\t[%#016llx-%#016llx], %#llx bytes%s\n",
+		pr_info(" %s[%#x]\t[%#010llx-%#010llx], %#llx bytes%s\n",
 			name, i, base, base + size - 1, size, nid_buf);
 	}
 }

[-- Attachment #3: nobootmem_name_2.patch --]
[-- Type: application/octet-stream, Size: 21862 bytes --]

Subject: [PATCH] x86: Add name for bootmem print out -- part two

So We can get more overview of usages of bootmem.
It is only used when CONFIG_NO_BOOTMEM=y

Signed-off-by: Yinghai <yinghai@kernel.org>

---
 arch/x86/kernel/acpi/boot.c    |    1 +
 arch/x86/kernel/apic/io_apic.c |    2 ++
 arch/x86/kernel/cpu/common.c   |    4 ++++
 arch/x86/kernel/e820.c         |    1 +
 arch/x86/kernel/setup_percpu.c |    1 +
 arch/x86/kernel/tce_64.c       |    2 ++
 arch/x86/kernel/xsave.c        |    3 +++
 arch/x86/mm/init_32.c          |    5 ++++-
 arch/x86/mm/init_64.c          |    4 +++-
 arch/x86/mm/numa.c             |    6 ++++--
 drivers/firmware/memmap.c      |    1 +
 include/linux/bootmem.h        |    3 +++
 init/main.c                    |    2 ++
 kernel/power/snapshot.c        |    4 +++-
 kernel/printk.c                |    1 +
 kernel/sched/core.c            |    2 ++
 lib/swiotlb.c                  |    4 ++++
 mm/hugetlb.c                   |    1 +
 mm/nobootmem.c                 |   15 ++++++++++++++-
 mm/page_alloc.c                |   14 ++++++++++----
 mm/page_cgroup.c               |    1 +
 mm/percpu.c                    |   11 +++++++++++
 mm/sparse-vmemmap.c            |    9 ++++++---
 mm/sparse.c                    |   10 +++++++++-
 24 files changed, 93 insertions(+), 14 deletions(-)

Index: linux-2.6/arch/x86/kernel/acpi/boot.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/acpi/boot.c
+++ linux-2.6/arch/x86/kernel/acpi/boot.c
@@ -783,6 +783,7 @@ static int __init acpi_parse_hpet(struct
 	 * the resource tree during the lateinit timeframe.
 	 */
 #define HPET_RESOURCE_NAME_SIZE 9
+	set_bootmem_name("hpet res");
 	hpet_res = alloc_bootmem(sizeof(*hpet_res) + HPET_RESOURCE_NAME_SIZE);
 
 	hpet_res->name = (void *)&hpet_res[1];
Index: linux-2.6/arch/x86/kernel/apic/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic/io_apic.c
+++ linux-2.6/arch/x86/kernel/apic/io_apic.c
@@ -3920,6 +3920,7 @@ static struct resource * __init ioapic_s
 	n = IOAPIC_RESOURCE_NAME_SIZE + sizeof(struct resource);
 	n *= nr_ioapics;
 
+	set_bootmem_name("ioapic res");
 	mem = alloc_bootmem(n);
 	res = (void *)mem;
 
@@ -3967,6 +3968,7 @@ static void __init __ioapic_init_mapping
 #ifdef CONFIG_X86_32
 fake_ioapic_page:
 #endif
+			set_bootmem_name("ioapic reg dumy");
 			ioapic_phys = (unsigned long)alloc_bootmem_pages(PAGE_SIZE);
 			ioapic_phys = __pa(ioapic_phys);
 			set_fixmap_nocache(idx, ioapic_phys);
Index: linux-2.6/arch/x86/kernel/cpu/common.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/common.c
+++ linux-2.6/arch/x86/kernel/cpu/common.c
@@ -55,9 +55,13 @@ cpumask_var_t cpu_sibling_setup_mask;
 /* correctly size the local cpu masks */
 void __init setup_cpu_local_masks(void)
 {
+	set_bootmem_name("cpu_initialized_mask");
 	alloc_bootmem_cpumask_var(&cpu_initialized_mask);
+	set_bootmem_name("cpu_callin_mask");
 	alloc_bootmem_cpumask_var(&cpu_callin_mask);
+	set_bootmem_name("cpu_callout_mask");
 	alloc_bootmem_cpumask_var(&cpu_callout_mask);
+	set_bootmem_name("cpu_sibling_setup_mask");
 	alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask);
 }
 
Index: linux-2.6/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820.c
+++ linux-2.6/arch/x86/kernel/e820.c
@@ -960,6 +960,7 @@ void __init e820_reserve_resources(void)
 	struct resource *res;
 	u64 end;
 
+	set_bootmem_name("e820 resources");
 	res = alloc_bootmem(sizeof(struct resource) * e820.nr_map);
 	e820_res = res;
 	for (i = 0; i < e820.nr_map; i++) {
Index: linux-2.6/arch/x86/kernel/setup_percpu.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup_percpu.c
+++ linux-2.6/arch/x86/kernel/setup_percpu.c
@@ -126,6 +126,7 @@ static void * __init pcpu_alloc_bootmem(
  */
 static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size, size_t align)
 {
+	set_bootmem_name("pcpu_alloc");
 	return pcpu_alloc_bootmem(cpu, size, align);
 }
 
Index: linux-2.6/arch/x86/kernel/tce_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/tce_64.c
+++ linux-2.6/arch/x86/kernel/tce_64.c
@@ -173,6 +173,8 @@ void * __init alloc_tce_table(void)
 	size = table_size_to_number_of_entries(specified_table_size);
 	size *= TCE_ENTRY_SIZE;
 
+	set_bootmem_name("tce table");
+
 	return __alloc_bootmem_low(size, size, 0);
 }
 
Index: linux-2.6/arch/x86/kernel/xsave.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/xsave.c
+++ linux-2.6/arch/x86/kernel/xsave.c
@@ -364,7 +364,9 @@ static void __init setup_xstate_features
 	int eax, ebx, ecx, edx, leaf = 0x2;
 
 	xstate_features = fls64(pcntxt_mask);
+	set_bootmem_name("xstate_offsets");
 	xstate_offsets = alloc_bootmem(xstate_features * sizeof(int));
+	set_bootmem_name("xstate_sizes");
 	xstate_sizes = alloc_bootmem(xstate_features * sizeof(int));
 
 	do {
@@ -391,6 +393,7 @@ static void __init setup_xstate_init(voi
 	 * Setup init_xstate_buf to represent the init state of
 	 * all the features managed by the xsave
 	 */
+	set_bootmem_name("xstate_buf");
 	init_xstate_buf = alloc_bootmem_align(xstate_size,
 					      __alignof__(struct xsave_struct));
 	init_xstate_buf->i387.mxcsr = MXCSR_DEFAULT;
Index: linux-2.6/arch/x86/mm/init_32.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/init_32.c
+++ linux-2.6/arch/x86/mm/init_32.c
@@ -84,8 +84,10 @@ static pmd_t * __init one_md_table_init(
 
 #ifdef CONFIG_X86_PAE
 	if (!(pgd_val(*pgd) & _PAGE_PRESENT)) {
-		if (after_bootmem)
+		if (after_bootmem) {
+			set_bootmem_name("pgtable pmd");
 			pmd_table = (pmd_t *)alloc_bootmem_pages(PAGE_SIZE);
+		}
 		else
 			pmd_table = (pmd_t *)alloc_low_page();
 		paravirt_alloc_pmd(&init_mm, __pa(pmd_table) >> PAGE_SHIFT);
@@ -112,6 +114,7 @@ static pte_t * __init one_page_table_ini
 		pte_t *page_table = NULL;
 
 		if (after_bootmem) {
+			set_bootmem_name("pgtable pte");
 #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KMEMCHECK)
 			page_table = (pte_t *) alloc_bootmem_pages(PAGE_SIZE);
 #endif
Index: linux-2.6/arch/x86/mm/init_64.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/init_64.c
+++ linux-2.6/arch/x86/mm/init_64.c
@@ -144,8 +144,10 @@ static __ref void *spp_getpage(void)
 
 	if (after_bootmem)
 		ptr = (void *) get_zeroed_page(GFP_ATOMIC | __GFP_NOTRACK);
-	else
+	else {
+		set_bootmem_name("pgtable");
 		ptr = alloc_bootmem_pages(PAGE_SIZE);
+	}
 
 	if (!ptr || ((unsigned long)ptr & ~PAGE_MASK)) {
 		panic("set_pte_phys: cannot allocate page data %s\n",
Index: linux-2.6/arch/x86/mm/numa.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/numa.c
+++ linux-2.6/arch/x86/mm/numa.c
@@ -125,8 +125,10 @@ void __init setup_node_to_cpumask_map(vo
 	}
 
 	/* allocate the map */
-	for (node = 0; node < nr_node_ids; node++)
+	for (node = 0; node < nr_node_ids; node++) {
+		set_bootmem_name("node_to_cpumask_map");
 		alloc_bootmem_cpumask_var(&node_to_cpumask_map[node]);
+	}
 
 	/* cpumask_of_node() will now work */
 	pr_debug("Node to cpumask map for %d nodes\n", nr_node_ids);
@@ -393,7 +395,7 @@ static int __init numa_alloc_distance(vo
 		numa_distance = (void *)1LU;
 		return -ENOMEM;
 	}
-	memblock_reserve(phys, size);
+	__memblock_reserve(phys, size, "NODE DIST");
 
 	numa_distance = __va(phys);
 	numa_distance_cnt = cnt;
Index: linux-2.6/drivers/firmware/memmap.c
===================================================================
--- linux-2.6.orig/drivers/firmware/memmap.c
+++ linux-2.6/drivers/firmware/memmap.c
@@ -189,6 +189,7 @@ int __init firmware_map_add_early(u64 st
 {
 	struct firmware_map_entry *entry;
 
+	set_bootmem_name("firmware map");
 	entry = alloc_bootmem(sizeof(struct firmware_map_entry));
 	if (WARN_ON(!entry))
 		return -ENOMEM;
Index: linux-2.6/include/linux/bootmem.h
===================================================================
--- linux-2.6.orig/include/linux/bootmem.h
+++ linux-2.6/include/linux/bootmem.h
@@ -34,6 +34,9 @@ typedef struct bootmem_data {
 } bootmem_data_t;
 
 extern bootmem_data_t bootmem_node_data[];
+static inline void set_bootmem_name(char *name) {}
+#else
+void set_bootmem_name(char *name);
 #endif
 
 extern unsigned long bootmem_bootmap_pages(unsigned long);
Index: linux-2.6/init/main.c
===================================================================
--- linux-2.6.orig/init/main.c
+++ linux-2.6/init/main.c
@@ -339,7 +339,9 @@ static inline void smp_prepare_cpus(unsi
  */
 static void __init setup_command_line(char *command_line)
 {
+	set_bootmem_name("saved_command_line");
 	saved_command_line = alloc_bootmem(strlen (boot_command_line)+1);
+	set_bootmem_name("static_command_line");
 	static_command_line = alloc_bootmem(strlen (command_line)+1);
 	strcpy (saved_command_line, boot_command_line);
 	strcpy (static_command_line, command_line);
Index: linux-2.6/kernel/power/snapshot.c
===================================================================
--- linux-2.6.orig/kernel/power/snapshot.c
+++ linux-2.6/kernel/power/snapshot.c
@@ -635,9 +635,11 @@ __register_nosave_region(unsigned long s
 		/* during init, this shouldn't fail */
 		region = kmalloc(sizeof(struct nosave_region), GFP_KERNEL);
 		BUG_ON(!region);
-	} else
+	} else {
 		/* This allocation cannot fail */
+		set_bootmem_name("nosave region");
 		region = alloc_bootmem(sizeof(struct nosave_region));
+	}
 	region->start_pfn = start_pfn;
 	region->end_pfn = end_pfn;
 	list_add_tail(&region->list, &nosave_regions);
Index: linux-2.6/kernel/printk.c
===================================================================
--- linux-2.6.orig/kernel/printk.c
+++ linux-2.6/kernel/printk.c
@@ -206,6 +206,7 @@ void __init setup_log_buf(int early)
 			return;
 		new_log_buf = __va(mem);
 	} else {
+		set_bootmem_name("new log buf");
 		new_log_buf = alloc_bootmem_nopanic(new_log_buf_len);
 	}
 
Index: linux-2.6/kernel/sched/core.c
===================================================================
--- linux-2.6.orig/kernel/sched/core.c
+++ linux-2.6/kernel/sched/core.c
@@ -70,6 +70,7 @@
 #include <linux/ctype.h>
 #include <linux/ftrace.h>
 #include <linux/slab.h>
+#include <linux/bootmem.h>
 #include <linux/init_task.h>
 #include <linux/binfmts.h>
 
@@ -5891,6 +5892,7 @@ static cpumask_var_t cpu_isolated_map;
 /* Setup the mask of cpus configured for isolated domains */
 static int __init isolated_cpu_setup(char *str)
 {
+	set_bootmem_name("cpu_isolated_map");
 	alloc_bootmem_cpumask_var(&cpu_isolated_map);
 	cpulist_parse(str, cpu_isolated_map);
 	return 1;
Index: linux-2.6/lib/swiotlb.c
===================================================================
--- linux-2.6.orig/lib/swiotlb.c
+++ linux-2.6/lib/swiotlb.c
@@ -152,15 +152,18 @@ void __init swiotlb_init_with_tbl(char *
 	 * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE
 	 * between io_tlb_start and io_tlb_end.
 	 */
+	set_bootmem_name("swiotlb list");
 	io_tlb_list = alloc_bootmem_pages(PAGE_ALIGN(io_tlb_nslabs * sizeof(int)));
 	for (i = 0; i < io_tlb_nslabs; i++)
  		io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE);
 	io_tlb_index = 0;
+	set_bootmem_name("swiotlb orig_addr");
 	io_tlb_orig_addr = alloc_bootmem_pages(PAGE_ALIGN(io_tlb_nslabs * sizeof(phys_addr_t)));
 
 	/*
 	 * Get the overflow emergency buffer
 	 */
+	set_bootmem_name("swiotlb overflow buffer");
 	io_tlb_overflow_buffer = alloc_bootmem_low_pages(PAGE_ALIGN(io_tlb_overflow));
 	if (!io_tlb_overflow_buffer)
 		panic("Cannot allocate SWIOTLB overflow buffer!\n");
@@ -187,6 +190,7 @@ swiotlb_init_with_default_size(size_t de
 	/*
 	 * Get IO TLB memory from the low pages
 	 */
+	set_bootmem_name("swiotlb buffer");
 	io_tlb_start = alloc_bootmem_low_pages(PAGE_ALIGN(bytes));
 	if (!io_tlb_start)
 		panic("Cannot allocate SWIOTLB buffer");
Index: linux-2.6/mm/hugetlb.c
===================================================================
--- linux-2.6.orig/mm/hugetlb.c
+++ linux-2.6/mm/hugetlb.c
@@ -1155,6 +1155,7 @@ int __weak alloc_bootmem_huge_page(struc
 	while (nr_nodes) {
 		void *addr;
 
+		set_bootmem_name("huge_page");
 		addr = __alloc_bootmem_node_nopanic(
 				NODE_DATA(hstate_next_node_to_alloc(h,
 						&node_states[N_HIGH_MEMORY])),
Index: linux-2.6/mm/nobootmem.c
===================================================================
--- linux-2.6.orig/mm/nobootmem.c
+++ linux-2.6/mm/nobootmem.c
@@ -32,6 +32,14 @@ unsigned long max_low_pfn;
 unsigned long min_low_pfn;
 unsigned long max_pfn;
 
+static char __initdata bootmem_name[16] = "BOOTMEM";
+
+void __init set_bootmem_name(char *name)
+{
+	memset(bootmem_name, 0, sizeof(bootmem_name));
+	strncpy(bootmem_name, name, 15);
+}
+
 static void * __init __alloc_memory_core_early(int nid, u64 size, u64 align,
 					u64 goal, u64 limit)
 {
@@ -47,7 +55,12 @@ static void * __init __alloc_memory_core
 
 	ptr = phys_to_virt(addr);
 	memset(ptr, 0, size);
-	memblock_reserve(addr, size);
+	__memblock_reserve(addr, size, bootmem_name);
+	if (!strncmp(bootmem_name, "BOOTMEM", 7))
+		WARN(1, "NAME_NOT_SET");
+	else
+		set_bootmem_name("BOOTMEM");
+
 	/*
 	 * The min_count is set to 0 so that bootmem allocated blocks
 	 * are never reported as leaks.
Index: linux-2.6/mm/page_alloc.c
===================================================================
--- linux-2.6.orig/mm/page_alloc.c
+++ linux-2.6/mm/page_alloc.c
@@ -3821,6 +3821,7 @@ int zone_wait_table_init(struct zone *zo
 					* sizeof(wait_queue_head_t);
 
 	if (!slab_is_available()) {
+		set_bootmem_name("pgdat");
 		zone->wait_table = (wait_queue_head_t *)
 			alloc_bootmem_node_nopanic(pgdat, alloc_size);
 	} else {
@@ -4233,9 +4234,11 @@ static void __init setup_usemap(struct p
 {
 	unsigned long usemapsize = usemap_size(zonesize);
 	zone->pageblock_flags = NULL;
-	if (usemapsize)
+	if (usemapsize) {
+		set_bootmem_name("usemap");
 		zone->pageblock_flags = alloc_bootmem_node_nopanic(pgdat,
 								   usemapsize);
+	}
 }
 #else
 static inline void setup_usemap(struct pglist_data *pgdat,
@@ -4398,8 +4401,10 @@ static void __init_refok alloc_node_mem_
 		end = ALIGN(end, MAX_ORDER_NR_PAGES);
 		size =  (end - start) * sizeof(struct page);
 		map = alloc_remap(pgdat->node_id, size);
-		if (!map)
+		if (!map) {
+			set_bootmem_name("flat mem_map");
 			map = alloc_bootmem_node_nopanic(pgdat, size);
+		}
 		pgdat->node_mem_map = map + (pgdat->node_start_pfn - start);
 	}
 #ifndef CONFIG_NEED_MULTIPLE_NODES
@@ -5289,9 +5294,10 @@ void *__init alloc_large_system_hash(con
 
 	do {
 		size = bucketsize << log2qty;
-		if (flags & HASH_EARLY)
+		if (flags & HASH_EARLY) {
+			set_bootmem_name("large system hash");
 			table = alloc_bootmem_nopanic(size);
-		else if (hashdist)
+		} else if (hashdist)
 			table = __vmalloc(size, GFP_ATOMIC, PAGE_KERNEL);
 		else {
 			/*
Index: linux-2.6/mm/page_cgroup.c
===================================================================
--- linux-2.6.orig/mm/page_cgroup.c
+++ linux-2.6/mm/page_cgroup.c
@@ -54,6 +54,7 @@ static int __init alloc_node_page_cgroup
 
 	table_size = sizeof(struct page_cgroup) * nr_pages;
 
+	set_bootmem_name("cgroup");
 	base = __alloc_bootmem_node_nopanic(NODE_DATA(nid),
 			table_size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
 	if (!base)
Index: linux-2.6/mm/percpu.c
===================================================================
--- linux-2.6.orig/mm/percpu.c
+++ linux-2.6/mm/percpu.c
@@ -1063,6 +1063,7 @@ struct pcpu_alloc_info * __init pcpu_all
 			  __alignof__(ai->groups[0].cpu_map[0]));
 	ai_size = base_size + nr_units * sizeof(ai->groups[0].cpu_map[0]);
 
+	set_bootmem_name("pcpu_alloc_info");
 	ptr = alloc_bootmem_nopanic(PFN_ALIGN(ai_size));
 	if (!ptr)
 		return NULL;
@@ -1246,9 +1247,13 @@ int __init pcpu_setup_first_chunk(const
 	PCPU_SETUP_BUG_ON(pcpu_verify_alloc_info(ai) < 0);
 
 	/* process group information and build config tables accordingly */
+	set_bootmem_name("pcpu group_offsets");
 	group_offsets = alloc_bootmem(ai->nr_groups * sizeof(group_offsets[0]));
+	set_bootmem_name("pcpu group_sizes");
 	group_sizes = alloc_bootmem(ai->nr_groups * sizeof(group_sizes[0]));
+	set_bootmem_name("pcpu unit_map");
 	unit_map = alloc_bootmem(nr_cpu_ids * sizeof(unit_map[0]));
+	set_bootmem_name("pcpu unit_off");
 	unit_off = alloc_bootmem(nr_cpu_ids * sizeof(unit_off[0]));
 
 	for (cpu = 0; cpu < nr_cpu_ids; cpu++)
@@ -1311,6 +1316,7 @@ int __init pcpu_setup_first_chunk(const
 	 * empty chunks.
 	 */
 	pcpu_nr_slots = __pcpu_size_to_slot(pcpu_unit_size) + 2;
+	set_bootmem_name("pcpu slot");
 	pcpu_slot = alloc_bootmem(pcpu_nr_slots * sizeof(pcpu_slot[0]));
 	for (i = 0; i < pcpu_nr_slots; i++)
 		INIT_LIST_HEAD(&pcpu_slot[i]);
@@ -1322,6 +1328,7 @@ int __init pcpu_setup_first_chunk(const
 	 * covers static area + reserved area (mostly used for module
 	 * static percpu allocation).
 	 */
+	set_bootmem_name("pcpu chunk_struct");
 	schunk = alloc_bootmem(pcpu_chunk_struct_size);
 	INIT_LIST_HEAD(&schunk->list);
 	schunk->base_addr = base_addr;
@@ -1346,6 +1353,7 @@ int __init pcpu_setup_first_chunk(const
 
 	/* init dynamic chunk if necessary */
 	if (dyn_size) {
+		set_bootmem_name("pcpu chunk_struct dyn");
 		dchunk = alloc_bootmem(pcpu_chunk_struct_size);
 		INIT_LIST_HEAD(&dchunk->list);
 		dchunk->base_addr = base_addr;
@@ -1623,6 +1631,7 @@ int __init pcpu_embed_first_chunk(size_t
 	size_sum = ai->static_size + ai->reserved_size + ai->dyn_size;
 	areas_size = PFN_ALIGN(ai->nr_groups * sizeof(void *));
 
+	set_bootmem_name("pcpu area");
 	areas = alloc_bootmem_nopanic(areas_size);
 	if (!areas) {
 		rc = -ENOMEM;
@@ -1746,6 +1755,7 @@ int __init pcpu_page_first_chunk(size_t
 	/* unaligned allocations can't be freed, round up to page size */
 	pages_size = PFN_ALIGN(unit_pages * num_possible_cpus() *
 			       sizeof(pages[0]));
+	set_bootmem_name("pcpu pages");
 	pages = alloc_bootmem(pages_size);
 
 	/* allocate pages */
@@ -1882,6 +1892,7 @@ void __init setup_per_cpu_areas(void)
 	void *fc;
 
 	ai = pcpu_alloc_alloc_info(1, 1);
+	set_bootmem_name("percpu area");
 	fc = __alloc_bootmem(unit_size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
 	if (!ai || !fc)
 		panic("Failed to allocate memory for percpu areas.");
Index: linux-2.6/mm/sparse-vmemmap.c
===================================================================
--- linux-2.6.orig/mm/sparse-vmemmap.c
+++ linux-2.6/mm/sparse-vmemmap.c
@@ -38,8 +38,11 @@
 static void * __init_refok __earlyonly_bootmem_alloc(int node,
 				unsigned long size,
 				unsigned long align,
-				unsigned long goal)
+				unsigned long goal,
+				char *name)
 {
+	set_bootmem_name(name);
+
 	return __alloc_bootmem_node_high(NODE_DATA(node), size, align, goal);
 }
 
@@ -63,7 +66,7 @@ void * __meminit vmemmap_alloc_block(uns
 		return NULL;
 	} else
 		return __earlyonly_bootmem_alloc(node, size, size,
-				__pa(MAX_DMA_ADDRESS));
+				__pa(MAX_DMA_ADDRESS), "vmemmap block");
 }
 
 /* need to make sure size is all the same during early stage */
@@ -195,7 +198,7 @@ void __init sparse_mem_maps_populate_nod
 
 	size = ALIGN(size, PMD_SIZE);
 	vmemmap_buf_start = __earlyonly_bootmem_alloc(nodeid, size * map_count,
-			 PMD_SIZE, __pa(MAX_DMA_ADDRESS));
+			 PMD_SIZE, __pa(MAX_DMA_ADDRESS), "vmemmap buf");
 
 	if (vmemmap_buf_start) {
 		vmemmap_buf = vmemmap_buf_start;
Index: linux-2.6/mm/sparse.c
===================================================================
--- linux-2.6.orig/mm/sparse.c
+++ linux-2.6/mm/sparse.c
@@ -68,8 +68,10 @@ static struct mem_section noinline __ini
 			section = kmalloc_node(array_size, GFP_KERNEL, nid);
 		else
 			section = kmalloc(array_size, GFP_KERNEL);
-	} else
+	} else {
+		set_bootmem_name("sparse section");
 		section = alloc_bootmem_node(NODE_DATA(nid), array_size);
+	}
 
 	if (section)
 		memset(section, 0, array_size);
@@ -288,6 +290,7 @@ sparse_early_usemaps_alloc_pgdat_section
 	 * this problem.
 	 */
 	section_nr = pfn_to_section_nr(__pa(pgdat) >> PAGE_SHIFT);
+	set_bootmem_name("usemap section");
 	return alloc_bootmem_section(usemap_size() * count, section_nr);
 }
 
@@ -354,6 +357,7 @@ static void __init sparse_early_usemaps_
 	usemap = sparse_early_usemaps_alloc_pgdat_section(NODE_DATA(nodeid),
 								 usemap_count);
 	if (!usemap) {
+		set_bootmem_name("usermap");
 		usemap = alloc_bootmem_node(NODE_DATA(nodeid), size * usemap_count);
 		if (!usemap) {
 			printk(KERN_WARNING "%s: allocation failed\n", __func__);
@@ -381,6 +385,7 @@ struct page __init *sparse_mem_map_popul
 		return map;
 
 	size = PAGE_ALIGN(sizeof(struct page) * PAGES_PER_SECTION);
+	set_bootmem_name("sparse mem_map");
 	map = __alloc_bootmem_node_high(NODE_DATA(nid), size,
 					 PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
 	return map;
@@ -406,6 +411,7 @@ void __init sparse_mem_maps_populate_nod
 	}
 
 	size = PAGE_ALIGN(size);
+	set_bootmem_name("sparse mem_map block");
 	map = __alloc_bootmem_node_high(NODE_DATA(nodeid), size * map_count,
 					 PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
 	if (map) {
@@ -498,6 +504,7 @@ void __init sparse_init(void)
 	 * sparse_early_mem_map_alloc, so allocate usemap_map at first.
 	 */
 	size = sizeof(unsigned long *) * NR_MEM_SECTIONS;
+	set_bootmem_name("usemap_map");
 	usemap_map = alloc_bootmem(size);
 	if (!usemap_map)
 		panic("can not allocate usemap_map\n");
@@ -539,6 +546,7 @@ void __init sparse_init(void)
 
 #ifdef CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER
 	size2 = sizeof(struct page *) * NR_MEM_SECTIONS;
+	set_bootmem_name("map_map");
 	map_map = alloc_bootmem(size2);
 	if (!map_map)
 		panic("can not allocate map_map\n");

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

* Re: [RFC PATCH] Expand memblock=debug to provide a bit more details (v1).
  2012-05-04 19:22 ` [RFC PATCH] Expand memblock=debug to provide a bit more details (v1) Yinghai Lu
@ 2012-05-04 19:24     ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 11+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-05-04 19:24 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: linux-kernel, tj, hpa, paul.gortmaker, akpm, linux-mm

On Fri, May 04, 2012 at 12:22:58PM -0700, Yinghai Lu wrote:
> On Fri, May 4, 2012 at 11:49 AM, Konrad Rzeszutek Wilk
> <konrad.wilk@oracle.com> wrote:
> > While trying to track down some memory allocation issues, I realized that
> > memblock=debug was giving some information, but for guests with 256GB or
> > so the majority of it was just:
> >
> >  memblock_reserve: [0x00003efeeea000-0x00003efeeeb000] __alloc_memory_core_early+0x5c/0x64
> >
> > which really didn't tell me that much. With these patches I know it is:
> >
> >  memblock_reserve: [0x00003ffe724000-0x00003ffe725000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
> >
> > .. which isn't really that useful for the problem I was tracking down, but
> > it does help in figuring out which routines are using memblock.
> >
> 
> that RET_IP is not very helpful for debugging.

Is there a better way of doing it that is automatic?
> 
> Actually I have local debug patch for memblock. please check if that
> is going to help debugging.
> 
> Thanks
> 
> Yinghai




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

* Re: [RFC PATCH] Expand memblock=debug to provide a bit more details (v1).
@ 2012-05-04 19:24     ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 11+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-05-04 19:24 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: linux-kernel, tj, hpa, paul.gortmaker, akpm, linux-mm

On Fri, May 04, 2012 at 12:22:58PM -0700, Yinghai Lu wrote:
> On Fri, May 4, 2012 at 11:49 AM, Konrad Rzeszutek Wilk
> <konrad.wilk@oracle.com> wrote:
> > While trying to track down some memory allocation issues, I realized that
> > memblock=debug was giving some information, but for guests with 256GB or
> > so the majority of it was just:
> >
> >  memblock_reserve: [0x00003efeeea000-0x00003efeeeb000] __alloc_memory_core_early+0x5c/0x64
> >
> > which really didn't tell me that much. With these patches I know it is:
> >
> >  memblock_reserve: [0x00003ffe724000-0x00003ffe725000] (4kB) vmemmap_pmd_populate+0x4b/0xa2
> >
> > .. which isn't really that useful for the problem I was tracking down, but
> > it does help in figuring out which routines are using memblock.
> >
> 
> that RET_IP is not very helpful for debugging.

Is there a better way of doing it that is automatic?
> 
> Actually I have local debug patch for memblock. please check if that
> is going to help debugging.
> 
> Thanks
> 
> Yinghai



--
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] 11+ messages in thread

* Re: [RFC PATCH] Expand memblock=debug to provide a bit more details (v1).
  2012-05-04 19:24     ` Konrad Rzeszutek Wilk
@ 2012-05-08 17:35       ` H. Peter Anvin
  -1 siblings, 0 replies; 11+ messages in thread
From: H. Peter Anvin @ 2012-05-08 17:35 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: Yinghai Lu, linux-kernel, tj, paul.gortmaker, akpm, linux-mm

On 05/04/2012 12:24 PM, Konrad Rzeszutek Wilk wrote:
>>
>> that RET_IP is not very helpful for debugging.
> 
> Is there a better way of doing it that is automatic?
>>

It depends on what "it" is.  You could do a full stack backtrace, or use
__builtin_return_address(N).

	-hpa


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

* Re: [RFC PATCH] Expand memblock=debug to provide a bit more details (v1).
@ 2012-05-08 17:35       ` H. Peter Anvin
  0 siblings, 0 replies; 11+ messages in thread
From: H. Peter Anvin @ 2012-05-08 17:35 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: Yinghai Lu, linux-kernel, tj, paul.gortmaker, akpm, linux-mm

On 05/04/2012 12:24 PM, Konrad Rzeszutek Wilk wrote:
>>
>> that RET_IP is not very helpful for debugging.
> 
> Is there a better way of doing it that is automatic?
>>

It depends on what "it" is.  You could do a full stack backtrace, or use
__builtin_return_address(N).

	-hpa

--
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] 11+ messages in thread

end of thread, other threads:[~2012-05-08 17:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-04 18:49 [RFC PATCH] Expand memblock=debug to provide a bit more details (v1) Konrad Rzeszutek Wilk
2012-05-04 18:49 ` Konrad Rzeszutek Wilk
2012-05-04 18:49 ` [PATCH 1/2] memblock: Add _THIS_IP off the caller to memblock debug statements and size in kB Konrad Rzeszutek Wilk
2012-05-04 18:49   ` Konrad Rzeszutek Wilk
2012-05-04 18:49 ` [PATCH 2/2] bootmem/sparsemem: Have a new __alloc_bootmem_node_high Konrad Rzeszutek Wilk
2012-05-04 18:49   ` Konrad Rzeszutek Wilk
2012-05-04 19:22 ` [RFC PATCH] Expand memblock=debug to provide a bit more details (v1) Yinghai Lu
2012-05-04 19:24   ` Konrad Rzeszutek Wilk
2012-05-04 19:24     ` Konrad Rzeszutek Wilk
2012-05-08 17:35     ` H. Peter Anvin
2012-05-08 17:35       ` H. Peter Anvin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.