diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 40954fb815988675a8b71c27cbea08c2f13f22e4..6d3550ca028201cf74f266d16789cc9608f71d0f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2775,11 +2775,11 @@ unsigned long __meminit __absent_pages_in_range(int nid, if (i == -1) return 0; + prev_end_pfn = min(early_node_map[i].start_pfn, range_end_pfn); + /* Account for ranges before physical memory on this node */ if (early_node_map[i].start_pfn > range_start_pfn) - hole_pages = early_node_map[i].start_pfn - range_start_pfn; - - prev_end_pfn = early_node_map[i].start_pfn; + hole_pages = prev_end_pfn - range_start_pfn; /* Find all holes for the zone within the node */ for (; i != -1; i = next_active_region_index_in_nid(i, nid)) {