]> git.openfabrics.org - ~shefty/rdma-dev.git/blobdiff - mm/page_alloc.c
memory-hotplug: fix NR_FREE_PAGES mismatch
[~shefty/rdma-dev.git] / mm / page_alloc.c
index 6f50cfe98a7b6dda0be18387f501c2458f362061..4dba04f06880f1a4a5a28ac08fb167f0899a925d 100644 (file)
@@ -667,11 +667,13 @@ static void free_pcppages_bulk(struct zone *zone, int count,
                        /* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */
                        __free_one_page(page, zone, 0, mt);
                        trace_mm_page_pcpu_drain(page, 0, mt);
-                       if (is_migrate_cma(mt))
-                               __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, 1);
+                       if (likely(get_pageblock_migratetype(page) != MIGRATE_ISOLATE)) {
+                               __mod_zone_page_state(zone, NR_FREE_PAGES, 1);
+                               if (is_migrate_cma(mt))
+                                       __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, 1);
+                       }
                } while (--to_free && --batch_free && !list_empty(list));
        }
-       __mod_zone_page_state(zone, NR_FREE_PAGES, count);
        spin_unlock(&zone->lock);
 }
 
@@ -6047,8 +6049,6 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn)
                list_del(&page->lru);
                rmv_page_order(page);
                zone->free_area[order].nr_free--;
-               __mod_zone_page_state(zone, NR_FREE_PAGES,
-                                     - (1UL << order));
                for (i = 0; i < (1 << order); i++)
                        SetPageReserved((page+i));
                pfn += (1 << order);