On Wed, Sep 13, 2023 at 02:51:09PM +0200, David Hildenbrand wrote: > @@ -1246,11 +1241,13 @@ void page_add_anon_rmap(struct page *page, struct vm_area_struct *vma, > > if (likely(!folio_test_ksm(folio))) { > if (first) > - __page_set_anon_rmap(folio, page, vma, address, > - !!(flags & RMAP_EXCLUSIVE)); > + __folio_set_anon(folio, vma, address, > + !!(flags & RMAP_EXCLUSIVE)); > else > __page_check_anon_rmap(folio, page, vma, address); > } > + if (flags & RMAP_EXCLUSIVE) > + SetPageAnonExclusive(page); Won't we end up setting AnonExclusive on ksm pages, or do we make sure to never pass RMAP_EXCLUSIVE for ksm pages? Maybe better to move these last two lines inside the previous test, just to avoid the question.