On Tue, Mar 19, 2024 at 08:48:42AM +0800, Zhaoyang Huang wrote: > BTW, damon_pa_pageout is a potential risk over this race No it isn't. struct folio *folio = damon_get_folio(PHYS_PFN(addr)); if (!folio) continue; if (damos_pa_filter_out(s, folio)) goto put_folio; folio_clear_referenced(folio); folio_test_clear_young(folio); if (!folio_isolate_lru(folio)) goto put_folio; if (folio_test_unevictable(folio)) folio_putback_lru(folio); else list_add(&folio->lru, &folio_list); put_folio: folio_put(folio); It clearly has a folio reference when it calls folio_isolate_lru().