Commit 1d16871d8c96deadc5f9753b6b096074f2cbcbe1
Committed by
Linus Torvalds
1 parent
e64a782fec
Exists in
master
and in
7 other branches
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 == MIGRATE_PCPTYPES. [akpm@linux-foundation.org: fix comment] Signed-off-by: Namhyung Kim <namhyung@gmail.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Mel Gorman <mel@csn.ul.ie> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 4 additions and 0 deletions Side-by-side Diff
mm/page_alloc.c
... | ... | @@ -614,6 +614,10 @@ |
614 | 614 | list = &pcp->lists[migratetype]; |
615 | 615 | } while (list_empty(list)); |
616 | 616 | |
617 | + /* This is the only non-empty list. Free them all. */ | |
618 | + if (batch_free == MIGRATE_PCPTYPES) | |
619 | + batch_free = to_free; | |
620 | + | |
617 | 621 | do { |
618 | 622 | page = list_entry(list->prev, struct page, lru); |
619 | 623 | /* must delete as __free_one_page list manipulates */ |