Revert "BACKPORT: mm: page_alloc: optimize free_unref_folios()"

This reverts commit ab0ad8d198.

Change-Id: I39d5a5398c6844abdd670e1d27c50e92c4235df9
Bug: 420771453
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
Kalesh Singh
2025-05-27 21:07:03 -07:00
parent 8b5d78fb5c
commit a7a0d95bca

View File

@@ -2802,10 +2802,22 @@ void free_unref_page_list(struct list_head *list)
/* Prepare pages for freeing */ /* Prepare pages for freeing */
list_for_each_entry_safe(page, next, list, lru) { list_for_each_entry_safe(page, next, list, lru) {
unsigned long pfn = page_to_pfn(page);
if (!free_pages_prepare(page, 0, FPI_NONE)) { if (!free_pages_prepare(page, 0, FPI_NONE)) {
list_del(&page->lru); list_del(&page->lru);
continue; continue;
} }
/*
* Free isolated pages directly to the allocator, see
* comment in free_unref_page.
*/
migratetype = get_pfnblock_migratetype(page, pfn);
if (unlikely(is_migrate_isolate(migratetype))) {
list_del(&page->lru);
free_one_page(page_zone(page), page, pfn, 0, FPI_NONE);
continue;
}
} }
trace_android_vh_free_unref_page_list_bypass(list, &skip_free); trace_android_vh_free_unref_page_list_bypass(list, &skip_free);
@@ -2824,13 +2836,10 @@ void free_unref_page_list(struct list_head *list)
* excessive lock hold times when freeing a large list of * excessive lock hold times when freeing a large list of
* pages. * pages.
*/ */
if (zone != locked_zone || batch_count == SWAP_CLUSTER_MAX || if (zone != locked_zone || batch_count == SWAP_CLUSTER_MAX) {
is_migrate_isolate(migratetype)) {
if (pcp) { if (pcp) {
pcp_spin_unlock(pcp); pcp_spin_unlock(pcp);
pcp_trylock_finish(UP_flags); pcp_trylock_finish(UP_flags);
locked_zone = NULL;
pcp = NULL;
} }
/* /*