diff options
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 40db96a655d0..aa6fcc7ca66f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/stop_machine.h> | 39 | #include <linux/stop_machine.h> |
40 | #include <linux/sort.h> | 40 | #include <linux/sort.h> |
41 | #include <linux/pfn.h> | 41 | #include <linux/pfn.h> |
42 | #include <linux/backing-dev.h> | ||
42 | 43 | ||
43 | #include <asm/tlbflush.h> | 44 | #include <asm/tlbflush.h> |
44 | #include <asm/div64.h> | 45 | #include <asm/div64.h> |
@@ -852,7 +853,7 @@ again: | |||
852 | pcp = &zone_pcp(zone, cpu)->pcp[cold]; | 853 | pcp = &zone_pcp(zone, cpu)->pcp[cold]; |
853 | local_irq_save(flags); | 854 | local_irq_save(flags); |
854 | if (!pcp->count) { | 855 | if (!pcp->count) { |
855 | pcp->count += rmqueue_bulk(zone, 0, | 856 | pcp->count = rmqueue_bulk(zone, 0, |
856 | pcp->batch, &pcp->list); | 857 | pcp->batch, &pcp->list); |
857 | if (unlikely(!pcp->count)) | 858 | if (unlikely(!pcp->count)) |
858 | goto failed; | 859 | goto failed; |
@@ -1050,7 +1051,7 @@ nofail_alloc: | |||
1050 | if (page) | 1051 | if (page) |
1051 | goto got_pg; | 1052 | goto got_pg; |
1052 | if (gfp_mask & __GFP_NOFAIL) { | 1053 | if (gfp_mask & __GFP_NOFAIL) { |
1053 | blk_congestion_wait(WRITE, HZ/50); | 1054 | congestion_wait(WRITE, HZ/50); |
1054 | goto nofail_alloc; | 1055 | goto nofail_alloc; |
1055 | } | 1056 | } |
1056 | } | 1057 | } |
@@ -1113,7 +1114,7 @@ rebalance: | |||
1113 | do_retry = 1; | 1114 | do_retry = 1; |
1114 | } | 1115 | } |
1115 | if (do_retry) { | 1116 | if (do_retry) { |
1116 | blk_congestion_wait(WRITE, HZ/50); | 1117 | congestion_wait(WRITE, HZ/50); |
1117 | goto rebalance; | 1118 | goto rebalance; |
1118 | } | 1119 | } |
1119 | 1120 | ||
@@ -1688,6 +1689,8 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, | |||
1688 | for (pfn = start_pfn; pfn < end_pfn; pfn++) { | 1689 | for (pfn = start_pfn; pfn < end_pfn; pfn++) { |
1689 | if (!early_pfn_valid(pfn)) | 1690 | if (!early_pfn_valid(pfn)) |
1690 | continue; | 1691 | continue; |
1692 | if (!early_pfn_in_nid(pfn, nid)) | ||
1693 | continue; | ||
1691 | page = pfn_to_page(pfn); | 1694 | page = pfn_to_page(pfn); |
1692 | set_page_links(page, zone, nid, pfn); | 1695 | set_page_links(page, zone, nid, pfn); |
1693 | init_page_count(page); | 1696 | init_page_count(page); |
@@ -2258,7 +2261,7 @@ unsigned long __init __absent_pages_in_range(int nid, | |||
2258 | 2261 | ||
2259 | /* Account for ranges past physical memory on this node */ | 2262 | /* Account for ranges past physical memory on this node */ |
2260 | if (range_end_pfn > prev_end_pfn) | 2263 | if (range_end_pfn > prev_end_pfn) |
2261 | hole_pages = range_end_pfn - | 2264 | hole_pages += range_end_pfn - |
2262 | max(range_start_pfn, prev_end_pfn); | 2265 | max(range_start_pfn, prev_end_pfn); |
2263 | 2266 | ||
2264 | return hole_pages; | 2267 | return hole_pages; |
@@ -2404,7 +2407,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat, | |||
2404 | zone->zone_pgdat = pgdat; | 2407 | zone->zone_pgdat = pgdat; |
2405 | zone->free_pages = 0; | 2408 | zone->free_pages = 0; |
2406 | 2409 | ||
2407 | zone->temp_priority = zone->prev_priority = DEF_PRIORITY; | 2410 | zone->prev_priority = DEF_PRIORITY; |
2408 | 2411 | ||
2409 | zone_pcp_init(zone); | 2412 | zone_pcp_init(zone); |
2410 | INIT_LIST_HEAD(&zone->active_list); | 2413 | INIT_LIST_HEAD(&zone->active_list); |
@@ -2609,6 +2612,9 @@ unsigned long __init find_min_pfn_for_node(unsigned long nid) | |||
2609 | { | 2612 | { |
2610 | int i; | 2613 | int i; |
2611 | 2614 | ||
2615 | /* Regions in the early_node_map can be in any order */ | ||
2616 | sort_node_map(); | ||
2617 | |||
2612 | /* Assuming a sorted map, the first range found has the starting pfn */ | 2618 | /* Assuming a sorted map, the first range found has the starting pfn */ |
2613 | for_each_active_range_index_in_nid(i, nid) | 2619 | for_each_active_range_index_in_nid(i, nid) |
2614 | return early_node_map[i].start_pfn; | 2620 | return early_node_map[i].start_pfn; |
@@ -2677,9 +2683,6 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn) | |||
2677 | max(max_zone_pfn[i], arch_zone_lowest_possible_pfn[i]); | 2683 | max(max_zone_pfn[i], arch_zone_lowest_possible_pfn[i]); |
2678 | } | 2684 | } |
2679 | 2685 | ||
2680 | /* Regions in the early_node_map can be in any order */ | ||
2681 | sort_node_map(); | ||
2682 | |||
2683 | /* Print out the zone ranges */ | 2686 | /* Print out the zone ranges */ |
2684 | printk("Zone PFN ranges:\n"); | 2687 | printk("Zone PFN ranges:\n"); |
2685 | for (i = 0; i < MAX_NR_ZONES; i++) | 2688 | for (i = 0; i < MAX_NR_ZONES; i++) |
@@ -3119,3 +3122,19 @@ unsigned long page_to_pfn(struct page *page) | |||
3119 | EXPORT_SYMBOL(pfn_to_page); | 3122 | EXPORT_SYMBOL(pfn_to_page); |
3120 | EXPORT_SYMBOL(page_to_pfn); | 3123 | EXPORT_SYMBOL(page_to_pfn); |
3121 | #endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */ | 3124 | #endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */ |
3125 | |||
3126 | #if MAX_NUMNODES > 1 | ||
3127 | /* | ||
3128 | * Find the highest possible node id. | ||
3129 | */ | ||
3130 | int highest_possible_node_id(void) | ||
3131 | { | ||
3132 | unsigned int node; | ||
3133 | unsigned int highest = 0; | ||
3134 | |||
3135 | for_each_node_mask(node, node_possible_map) | ||
3136 | highest = node; | ||
3137 | return highest; | ||
3138 | } | ||
3139 | EXPORT_SYMBOL(highest_possible_node_id); | ||
3140 | #endif | ||