From 24984ec8cc4c6590f21cc6f6d2db158c5b547b9e Mon Sep 17 00:00:00 2001 From: Yasunori Goto Date: Mon, 28 Apr 2008 02:13:33 -0700 Subject: [PATCH] --- yaml --- r: 94051 b: refs/heads/master c: 86f6dae1377523689bd8468fed2f2dd180fc0560 h: refs/heads/master i: 94049: 66f9c43c193e45f87d11aefd9318121c33d037dd 94047: 9f690a8a003d8b3045b00e8668ee167bc3e082ae v: v3 --- [refs] | 2 +- trunk/mm/sparse.c | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index a1ccc8793aa0..3a8cc0f5698c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e70260aabea3af2a84b951e75166dcebe689b88e +refs/heads/master: 86f6dae1377523689bd8468fed2f2dd180fc0560 diff --git a/trunk/mm/sparse.c b/trunk/mm/sparse.c index 5398d48c360a..08f053218ee8 100644 --- a/trunk/mm/sparse.c +++ b/trunk/mm/sparse.c @@ -249,11 +249,22 @@ static unsigned long *__kmalloc_section_usemap(void) static unsigned long *__init sparse_early_usemap_alloc(unsigned long 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); - usemap = alloc_bootmem_node(NODE_DATA(nid), usemap_size()); + /* + * Usemap's page can't be freed until freeing other sections + * which use it. And, Pgdat has same feature. + * If section A has pgdat and section B has usemap for other + * sections (includes section A), both sections can't be removed, + * because there is the dependency each other. + * To solve above issue, this collects all usemap on the same section + * which has pgdat. + */ + section_nr = pfn_to_section_nr(__pa(pgdat) >> PAGE_SHIFT); + usemap = alloc_bootmem_section(usemap_size(), section_nr); if (usemap) return usemap;