Commit 1d16871d authored by Namhyung Kim's avatar Namhyung Kim Committed by Linus Torvalds
Browse files

mm: batch-free pcp list if possible

free_pcppages_bulk() frees pages from pcp lists in a round-robin fashion
by keeping batch_free counter.  But it doesn't need to spin if there is
only one non-empty list.  This can be checked by batch_free ==

[ fix comment]
Signed-off-by: default avatarNamhyung Kim <>
Acked-by: default avatarJohannes Weiner <>
Cc: Mel Gorman <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent e64a782f
......@@ -614,6 +614,10 @@ static void free_pcppages_bulk(struct zone *zone, int count,
list = &pcp->lists[migratetype];
} while (list_empty(list));
/* This is the only non-empty list. Free them all. */
if (batch_free == MIGRATE_PCPTYPES)
batch_free = to_free;
do {
page = list_entry(list->prev, struct page, lru);
/* must delete as __free_one_page list manipulates */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment