static struct anon_vma *rmap_walk_anon_lock(struct folio *folio, struct rmap_walk_control *rwc) struct anon_vma *anon_vma; return rwc->anon_lock(folio, rwc); anon_vma = folio_anon_vma(folio); if (anon_vma_trylock_read(anon_vma)) anon_vma_lock_read(anon_vma);static void rmap_walk_anon(struct folio *folio, struct rmap_walk_control *rwc, bool locked) struct anon_vma *anon_vma; pgoff_t pgoff_start, pgoff_end; struct anon_vma_chain *avc; anon_vma = folio_anon_vma(folio); /* anon_vma disappear under us? */ VM_BUG_ON_FOLIO(!anon_vma, folio); anon_vma = rmap_walk_anon_lock(folio, rwc); pgoff_start = folio_pgoff(folio); pgoff_end = pgoff_start + folio_nr_pages(folio) - 1; anon_vma_interval_tree_foreach(avc, &anon_vma->rb_root, pgoff_start, pgoff_end) { struct vm_area_struct *vma = avc->vma; unsigned long address = vma_address(&folio->page, vma); VM_BUG_ON_VMA(address == -EFAULT, vma); if (rwc->invalid_vma && rwc->invalid_vma(vma, rwc->arg)) if (!rwc->rmap_one(folio, vma, address, rwc->arg)) if (rwc->done && rwc->done(folio)) anon_vma_unlock_read(anon_vma); |