@@ -2478,7 +2478,8 @@ void free_unref_page(struct page *page, unsigned int order)
*/
migratetype = get_pcppage_migratetype(page);
if (unlikely(migratetype >= MIGRATE_PCPTYPES)) {
- if (unlikely(is_migrate_isolate(migratetype))) {
+ if (unlikely(is_migrate_isolate(migratetype) ||
+ is_migrate_metadata(migratetype))) {
free_one_page(page_zone(page), page, pfn, order, migratetype, FPI_NONE);
return;
}
@@ -2522,7 +2523,8 @@ void free_unref_page_list(struct list_head *list)
* comment in free_unref_page.
*/
migratetype = get_pcppage_migratetype(page);
- if (unlikely(is_migrate_isolate(migratetype))) {
+ if (unlikely(is_migrate_isolate(migratetype) ||
+ is_migrate_metadata(migratetype))) {
list_del(&page->lru);
free_one_page(page_zone(page), page, pfn, 0, migratetype, FPI_NONE);
continue;
When a metadata page is returned to the page allocator because all the associated pages with metadata were freed, the page will be returned to the pcp list, which makes it very likely that it will be used to satisfy an allocation request. This is not optimal, because metadata pages should be used as a last resort, to increase the chances they are not in use when they are needed, to avoid costly page migration. Bypass the pcp lists when freeing metadata pages. Note that metadata pages can still end up on the pcp lists when a list is refilled, but this should only happen when memory is running low, which is as intended Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com> --- mm/page_alloc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)