diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 5291ba30f56b..14bab5fa1b65 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -843,6 +843,11 @@ static void free_pcppages_bulk(struct zone *zone, int count, if (nr_scanned) __mod_zone_page_state(zone, 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 (to_free) { struct page *page; struct list_head *list;