[lkml]   [2008]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 3/3 (RFC)](memory hotplug) align maps for easy removing

To free memmap and usemap easier, this patch aligns these maps to page size.

I know usemap size is too small to align page size.
It will be waste of area. So, there may be better way than this.

Followings are pros. and cons with other my ideas.
But I'm not sure which is better way.

a) Packing many section's usemap on one page. Count how many sections use
it in page_count.
- Avoid waisting area.
- This usemap's page will be hard(or impossible) to remove due to
It should be allocated on un-movable zone/node.
(I'm not sure it's impact of performance.)
- Nodes' structures may have to be packed like usemap???

b) Pack memmap and usemap in one allocation.
- May avoid wasting area if its size is suitable.
- If size is not suitable, it will be same as this patch.
- This way is not good for VMEMMAP_SPARSEMEM.
At least, it is reverse way against Yinghai-san's fix.

c) This way.
- Very easy to remove.
- Waist of area.

Any other idea is welcome.

Signed-off-by: Yasunori Goto <>

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

Index: current/mm/sparse.c
--- current.orig/mm/sparse.c 2008-03-11 20:15:41.000000000 +0900
+++ current/mm/sparse.c 2008-03-11 20:58:18.000000000 +0900
@@ -244,7 +244,8 @@
struct mem_section *ms = __nr_to_section(pnum);
int nid = sparse_early_nid(ms);

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

@@ -264,8 +265,8 @@
if (map)
return map;

- map = alloc_bootmem_node(NODE_DATA(nid),
- sizeof(struct page) * PAGES_PER_SECTION);
+ map = alloc_bootmem_pages_node(NODE_DATA(nid),
+ PAGE_ALIGN(sizeof(struct page) * PAGES_PER_SECTION));
return map;
Yasunori Goto

 \ /
  Last update: 2008-03-14 15:55    [W:0.065 / U:8.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site