mm: use zone_end_pfn() instead of zone_start_pfn+spanned_pages
[cascardo/linux.git] / mm / memory_hotplug.c
index ca1dd3a..9eadad6 100644 (file)
@@ -229,7 +229,7 @@ static void grow_zone_span(struct zone *zone, unsigned long start_pfn,
 
        zone_span_writelock(zone);
 
-       old_zone_end_pfn = zone->zone_start_pfn + zone->spanned_pages;
+       old_zone_end_pfn = zone_end_pfn(zone);
        if (!zone->spanned_pages || start_pfn < zone->zone_start_pfn)
                zone->zone_start_pfn = start_pfn;
 
@@ -514,8 +514,9 @@ static int find_biggest_section_pfn(int nid, struct zone *zone,
 static void shrink_zone_span(struct zone *zone, unsigned long start_pfn,
                             unsigned long end_pfn)
 {
-       unsigned long zone_start_pfn =  zone->zone_start_pfn;
-       unsigned long zone_end_pfn = zone->zone_start_pfn + zone->spanned_pages;
+       unsigned long zone_start_pfn = zone->zone_start_pfn;
+       unsigned long z = zone_end_pfn(zone); /* zone_end_pfn namespace clash */
+       unsigned long zone_end_pfn = z;
        unsigned long pfn;
        struct mem_section *ms;
        int nid = zone_to_nid(zone);
@@ -1472,7 +1473,6 @@ static int __ref __offline_pages(unsigned long start_pfn,
        struct zone *zone;
        struct memory_notify arg;
 
-       BUG_ON(start_pfn >= end_pfn);
        /* at least, alignment against pageblock is necessary */
        if (!IS_ALIGNED(start_pfn, pageblock_nr_pages))
                return -EINVAL;