diff --git a/mm/page_alloc.c b/mm/page_alloc.c index eac44f4bb956..6cdb331c977d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1166,6 +1166,11 @@ static void free_pcppages_bulk(struct zone *zone, int count, if (nr_scanned) __mod_node_page_state(zone->zone_pgdat, NR_PAGES_SCANNED, -nr_scanned); + /* + * Ensure proper count is passed which otherwise would stuck in the + * below while (list_empty(list)) loop. + */ + count = min(pcp->count, count); while (count) { struct page *page; struct list_head *list;