--- x/mm/page_alloc.c +++ y/mm/page_alloc.c @@ -2974,6 +2974,8 @@ void free_unref_folios(struct folio_batc unsigned int order = (unsigned long)folio->private; int migratetype; + if (!free_pages_prepare(&folio->page, order)) + continue; folio->private = NULL; migratetype = get_pfnblock_migratetype(&folio->page, pfn);