在 2024/6/17 下午5:52, David Hildenbrand 写道:
Why would we want to make folio_maybe_dma_pinned() detection that worse
Just want to fix it using the existing function, seems a little unreasonable. I will prepare the V2 using folio_test_lru(folio) to check.
static unsigned long collect_longterm_unpinnable_pages(...) { ... if (!folio_test_lru(folio) && drain_allow) { lru_add_drain_all(); drain_allow = false; } ... } void folio_mark_lazyfree(struct folio *folio) { if (folio_test_anon(folio) && folio_test_swapbacked(folio) && !folio_test_swapcache(folio) && !folio_test_unevictable(folio)) { struct folio_batch *fbatch; folio_get(folio); if (!folio_test_clear_lru(folio)) { folio_put(folio); return; } local_lock(&cpu_fbatches.lock); fbatch = this_cpu_ptr(&cpu_fbatches.lru_lazyfree); folio_batch_add_and_move(fbatch, folio, lru_lazyfree_fn); local_unlock(&cpu_fbatches.lock); } }