From 5cb9c7463c701fc77d7d286b703e24f9127662fe Mon Sep 17 00:00:00 2001 From: Yasunori Goto Date: Fri, 23 Jun 2006 02:03:11 -0700 Subject: [PATCH] --- yaml --- r: 28903 b: refs/heads/master c: 6811378e7d8b9aa4fca2a1ca73d24c9d67c9cb12 h: refs/heads/master i: 28901: 73fc2c44ca8ab8bcc910069656e33fa343f6437c 28899: 5f5335bccd92db41f139f5e6e722343a1b6a6d01 28895: 2d4ae56cb4901694a160e56d76b5bc7b67707ab5 v: v3 --- [refs] | 2 +- trunk/mm/memory_hotplug.c | 12 ++++++++++++ trunk/mm/page_alloc.c | 26 +++++++++++++++++++++----- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index a6d4138cecf5..1110a28b07a4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: cca448fe92246fb59efe55ba2e048ded0971a9af +refs/heads/master: 6811378e7d8b9aa4fca2a1ca73d24c9d67c9cb12 diff --git a/trunk/mm/memory_hotplug.c b/trunk/mm/memory_hotplug.c index 71da5c98c9c1..1b1ac3db2187 100644 --- a/trunk/mm/memory_hotplug.c +++ b/trunk/mm/memory_hotplug.c @@ -127,6 +127,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages) unsigned long flags; unsigned long onlined_pages = 0; struct zone *zone; + int need_zonelists_rebuild = 0; /* * This doesn't need a lock to do pfn_to_page(). @@ -139,6 +140,14 @@ int online_pages(unsigned long pfn, unsigned long nr_pages) grow_pgdat_span(zone->zone_pgdat, pfn, pfn + nr_pages); pgdat_resize_unlock(zone->zone_pgdat, &flags); + /* + * If this zone is not populated, then it is not in zonelist. + * This means the page allocator ignores this zone. + * So, zonelist must be updated after online. + */ + if (!populated_zone(zone)) + need_zonelists_rebuild = 1; + for (i = 0; i < nr_pages; i++) { struct page *page = pfn_to_page(pfn + i); online_page(page); @@ -149,5 +158,8 @@ int online_pages(unsigned long pfn, unsigned long nr_pages) setup_per_zone_pages_min(); + if (need_zonelists_rebuild) + build_all_zonelists(); + return 0; } diff --git a/trunk/mm/page_alloc.c b/trunk/mm/page_alloc.c index 62564e27b448..9dfbe6b7d1c8 100644 --- a/trunk/mm/page_alloc.c +++ b/trunk/mm/page_alloc.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -1704,14 +1705,29 @@ static void __meminit build_zonelists(pg_data_t *pgdat) #endif /* CONFIG_NUMA */ -void __init build_all_zonelists(void) +/* return values int ....just for stop_machine_run() */ +static int __meminit __build_all_zonelists(void *dummy) { - int i; + int nid; + for_each_online_node(nid) + build_zonelists(NODE_DATA(nid)); + return 0; +} + +void __meminit build_all_zonelists(void) +{ + if (system_state == SYSTEM_BOOTING) { + __build_all_zonelists(0); + cpuset_init_current_mems_allowed(); + } else { + /* we have to stop all cpus to guaranntee there is no user + of zonelist */ + stop_machine_run(__build_all_zonelists, NULL, NR_CPUS); + /* cpuset refresh routine should be here */ + } - for_each_online_node(i) - build_zonelists(NODE_DATA(i)); printk("Built %i zonelists\n", num_online_nodes()); - cpuset_init_current_mems_allowed(); + } /*