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");
