diff options
-rw-r--r-- | include/linux/nodemask.h | 10 | ||||
-rw-r--r-- | mm/memory_hotplug.c | 7 | ||||
-rw-r--r-- | mm/page_alloc.c | 25 |
3 files changed, 35 insertions, 7 deletions
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index 583e6b843d2a..ccee962f3559 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h | |||
@@ -341,8 +341,14 @@ static inline void __nodes_remap(nodemask_t *dstp, const nodemask_t *srcp, | |||
341 | * Bitmasks that are kept for all the nodes. | 341 | * Bitmasks that are kept for all the nodes. |
342 | */ | 342 | */ |
343 | enum node_states { | 343 | enum node_states { |
344 | N_POSSIBLE, /* The node could become online at some point */ | 344 | N_POSSIBLE, /* The node could become online at some point */ |
345 | N_ONLINE, /* The node is online */ | 345 | N_ONLINE, /* The node is online */ |
346 | N_NORMAL_MEMORY, /* The node has regular memory */ | ||
347 | #ifdef CONFIG_HIGHMEM | ||
348 | N_HIGH_MEMORY, /* The node has regular or high memory */ | ||
349 | #else | ||
350 | N_HIGH_MEMORY = N_NORMAL_MEMORY, | ||
351 | #endif | ||
346 | NR_NODE_STATES | 352 | NR_NODE_STATES |
347 | }; | 353 | }; |
348 | 354 | ||
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index df9d554bea30..9c12ae5e3695 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -217,6 +217,10 @@ int online_pages(unsigned long pfn, unsigned long nr_pages) | |||
217 | zone->zone_pgdat->node_present_pages += onlined_pages; | 217 | zone->zone_pgdat->node_present_pages += onlined_pages; |
218 | 218 | ||
219 | setup_per_zone_pages_min(); | 219 | setup_per_zone_pages_min(); |
220 | if (onlined_pages) { | ||
221 | kswapd_run(zone_to_nid(zone)); | ||
222 | node_set_state(zone_to_nid(zone), N_HIGH_MEMORY); | ||
223 | } | ||
220 | 224 | ||
221 | if (need_zonelists_rebuild) | 225 | if (need_zonelists_rebuild) |
222 | build_all_zonelists(); | 226 | build_all_zonelists(); |
@@ -271,9 +275,6 @@ int add_memory(int nid, u64 start, u64 size) | |||
271 | if (!pgdat) | 275 | if (!pgdat) |
272 | return -ENOMEM; | 276 | return -ENOMEM; |
273 | new_pgdat = 1; | 277 | new_pgdat = 1; |
274 | ret = kswapd_run(nid); | ||
275 | if (ret) | ||
276 | goto error; | ||
277 | } | 278 | } |
278 | 279 | ||
279 | /* call arch's memory hotadd */ | 280 | /* call arch's memory hotadd */ |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 0cc5b3e198e5..07dfd89992fa 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2080,14 +2080,35 @@ static void build_zonelist_cache(pg_data_t *pgdat) | |||
2080 | 2080 | ||
2081 | #endif /* CONFIG_NUMA */ | 2081 | #endif /* CONFIG_NUMA */ |
2082 | 2082 | ||
2083 | /* Any regular memory on that node ? */ | ||
2084 | static void check_for_regular_memory(pg_data_t *pgdat) | ||
2085 | { | ||
2086 | #ifdef CONFIG_HIGHMEM | ||
2087 | enum zone_type zone_type; | ||
2088 | |||
2089 | for (zone_type = 0; zone_type <= ZONE_NORMAL; zone_type++) { | ||
2090 | struct zone *zone = &pgdat->node_zones[zone_type]; | ||
2091 | if (zone->present_pages) | ||
2092 | node_set_state(zone_to_nid(zone), N_NORMAL_MEMORY); | ||
2093 | } | ||
2094 | #endif | ||
2095 | } | ||
2096 | |||
2083 | /* return values int ....just for stop_machine_run() */ | 2097 | /* return values int ....just for stop_machine_run() */ |
2084 | static int __build_all_zonelists(void *dummy) | 2098 | static int __build_all_zonelists(void *dummy) |
2085 | { | 2099 | { |
2086 | int nid; | 2100 | int nid; |
2087 | 2101 | ||
2088 | for_each_online_node(nid) { | 2102 | for_each_online_node(nid) { |
2089 | build_zonelists(NODE_DATA(nid)); | 2103 | pg_data_t *pgdat = NODE_DATA(nid); |
2090 | build_zonelist_cache(NODE_DATA(nid)); | 2104 | |
2105 | build_zonelists(pgdat); | ||
2106 | build_zonelist_cache(pgdat); | ||
2107 | |||
2108 | /* Any memory on that node */ | ||
2109 | if (pgdat->node_present_pages) | ||
2110 | node_set_state(nid, N_HIGH_MEMORY); | ||
2111 | check_for_regular_memory(pgdat); | ||
2091 | } | 2112 | } |
2092 | return 0; | 2113 | return 0; |
2093 | } | 2114 | } |