[Patch 004/005](memory hotplug)allocate usemap on the section with pgdat

From: Yasunori Goto
Date: Thu Apr 03 2008 - 01:45:43 EST




Usemaps are allocated on the section which has pgdat by this.

Because usemap size is very small, many usemaps for sections
are allocated on only one page. The page will be quite hard to
be removed until removing all other sections.
This dependency is not desirable for memory removing.

Pgdat has similar feature. If sections has pgdat area, it
must be the last section for removing on the node.

This is to collect the cause pages of its dependency on one section.
If other sections doesn't have any dependency, this section will
be able to be removed finally.


Signed-off-by: Yasunori Goto <y-goto@xxxxxxxxxxxxxx>


mm/sparse.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)

Index: current/mm/sparse.c
===================================================================
--- current.orig/mm/sparse.c 2008-04-01 20:59:07.000000000 +0900
+++ current/mm/sparse.c 2008-04-01 20:59:09.000000000 +0900
@@ -238,13 +238,23 @@
}
#endif /* CONFIG_MEMORY_HOTPLUG */

-static unsigned long *__init sparse_early_usemap_alloc(unsigned long pnum)
+static unsigned long *__init sparse_early_usemap_alloc(int pnum)
{
- unsigned long *usemap;
+ unsigned long *usemap, section_nr;
struct mem_section *ms = __nr_to_section(pnum);
int nid = sparse_early_nid(ms);
+ struct pglist_data *pgdat = NODE_DATA(nid);
+
+ /*
+ * This is allocated on same section of pgdat.
+ * It will not be freed until other sections hot-removing on the node.
+ * Pgdat has same feature. This collects all usemap on the same
+ * section.
+ */
+
+ section_nr = pfn_to_section_nr(__pa(pgdat) >> PAGE_SHIFT);
+ usemap = alloc_bootmem_section(usemap_size(), section_nr);

- usemap = alloc_bootmem_node(NODE_DATA(nid), usemap_size());
if (usemap)
return usemap;


--
Yasunori Goto


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/