diff --git a/mm/page_alloc.c b/mm/page_alloc.c index b65525513753..9e4b36e6e6b4 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1519,6 +1519,7 @@ static inline void expand(struct zone *zone, struct page *page, int low, int high, int migratetype) { unsigned long size = 1 << high; + unsigned long nr_added = 0; while (high > low) { high--; @@ -1535,9 +1536,10 @@ static inline void expand(struct zone *zone, struct page *page, continue; __add_to_free_list(&page[size], zone, high, migratetype, false); - account_freepages(zone, 1 << high, migratetype); set_buddy_order(&page[size], high); + nr_added += size; } + account_freepages(zone, nr_added, migratetype); } static void check_new_page_bad(struct page *page)