aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index beda41710802..5b5240b7f642 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1343,12 +1343,15 @@ static int prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags,
1343 set_page_owner(page, order, gfp_flags); 1343 set_page_owner(page, order, gfp_flags);
1344 1344
1345 /* 1345 /*
1346 * page->pfmemalloc is set when ALLOC_NO_WATERMARKS was necessary to 1346 * page is set pfmemalloc when ALLOC_NO_WATERMARKS was necessary to
1347 * allocate the page. The expectation is that the caller is taking 1347 * allocate the page. The expectation is that the caller is taking
1348 * steps that will free more memory. The caller should avoid the page 1348 * steps that will free more memory. The caller should avoid the page
1349 * being used for !PFMEMALLOC purposes. 1349 * being used for !PFMEMALLOC purposes.
1350 */ 1350 */
1351 page->pfmemalloc = !!(alloc_flags & ALLOC_NO_WATERMARKS); 1351 if (alloc_flags & ALLOC_NO_WATERMARKS)
1352 set_page_pfmemalloc(page);
1353 else
1354 clear_page_pfmemalloc(page);
1352 1355
1353 return 0; 1356 return 0;
1354} 1357}
@@ -3345,7 +3348,7 @@ refill:
3345 atomic_add(size - 1, &page->_count); 3348 atomic_add(size - 1, &page->_count);
3346 3349
3347 /* reset page count bias and offset to start of new frag */ 3350 /* reset page count bias and offset to start of new frag */
3348 nc->pfmemalloc = page->pfmemalloc; 3351 nc->pfmemalloc = page_is_pfmemalloc(page);
3349 nc->pagecnt_bias = size; 3352 nc->pagecnt_bias = size;
3350 nc->offset = size; 3353 nc->offset = size;
3351 } 3354 }
@@ -5060,6 +5063,10 @@ static unsigned long __meminit zone_spanned_pages_in_node(int nid,
5060{ 5063{
5061 unsigned long zone_start_pfn, zone_end_pfn; 5064 unsigned long zone_start_pfn, zone_end_pfn;
5062 5065
5066 /* When hotadd a new node, the node should be empty */
5067 if (!node_start_pfn && !node_end_pfn)
5068 return 0;
5069
5063 /* Get the start and end of the zone */ 5070 /* Get the start and end of the zone */
5064 zone_start_pfn = arch_zone_lowest_possible_pfn[zone_type]; 5071 zone_start_pfn = arch_zone_lowest_possible_pfn[zone_type];
5065 zone_end_pfn = arch_zone_highest_possible_pfn[zone_type]; 5072 zone_end_pfn = arch_zone_highest_possible_pfn[zone_type];
@@ -5123,6 +5130,10 @@ static unsigned long __meminit zone_absent_pages_in_node(int nid,
5123 unsigned long zone_high = arch_zone_highest_possible_pfn[zone_type]; 5130 unsigned long zone_high = arch_zone_highest_possible_pfn[zone_type];
5124 unsigned long zone_start_pfn, zone_end_pfn; 5131 unsigned long zone_start_pfn, zone_end_pfn;
5125 5132
5133 /* When hotadd a new node, the node should be empty */
5134 if (!node_start_pfn && !node_end_pfn)
5135 return 0;
5136
5126 zone_start_pfn = clamp(node_start_pfn, zone_low, zone_high); 5137 zone_start_pfn = clamp(node_start_pfn, zone_low, zone_high);
5127 zone_end_pfn = clamp(node_end_pfn, zone_low, zone_high); 5138 zone_end_pfn = clamp(node_end_pfn, zone_low, zone_high);
5128 5139