On Fri, 23 Aug 2024 23:02:06 +0800 Zhiguo Jiang <justinjiang@xxxxxxxx> wrote: > After CoWed by do_wp_page, the vma established a new mapping relationship > with the CoWed folio instead of the non-CoWed folio. However, regarding > the situation where vma->anon_vma and the non-CoWed folio's anon_vma are > not same, the avc binding relationship between them will no longer be > needed, so it is issue for the avc binding relationship still existing > between them. > > This patch will remove the avc binding relationship between vma and the > non-CoWed folio's anon_vma, which each has their own independent > anon_vma. It can also alleviates rmap overhead simultaneously. I assume any performance benefits are unmeasurable? I'll queue it for testing and shall await reviewer input. > --- a/mm/rmap.c > +++ b/mm/rmap.c > @@ -1522,6 +1522,59 @@ void folio_add_file_rmap_pmd(struct folio *folio, struct page *page, > #endif > } > > +/** > + * folio_remove_anon_avc - remove the avc binding relationship between > + * folio and vma with different anon_vmas. > + * @folio: The folio with anon_vma to remove the binded avc from > + * @vma: The vm area to remove the binded avc with folio's anon_vma > + * > + * The caller is currently used for CoWed scene. > + */ > +void folio_remove_anon_avc(struct folio *folio, > + struct vm_area_struct *vma) > +{ > > ... > In mm-unstable a lot of vma functions have been moved into the new file mm/vma.c. I suspect folio_remove_anon_avc() should be there also?