diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index dd367e5df8cbb2833372a050fbd99e52976e8c10..37ce0c2f3bae87a61700df5b917ba7dda82f79e7 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1600,13 +1600,14 @@ static void __free_pages_ok(struct page *page, unsigned int order,
 	migratetype = get_pfnblock_migratetype(page, pfn);
 
 	spin_lock_irqsave(&zone->lock, flags);
-	__count_vm_events(PGFREE, 1 << order);
 	if (unlikely(has_isolate_pageblock(zone) ||
 		is_migrate_isolate(migratetype))) {
 		migratetype = get_pfnblock_migratetype(page, pfn);
 	}
 	__free_one_page(page, pfn, zone, order, migratetype, fpi_flags);
 	spin_unlock_irqrestore(&zone->lock, flags);
+
+	__count_vm_events(PGFREE, 1 << order);
 }
 
 void __free_pages_core(struct page *page, unsigned int order)