On 13.09.23 16:32, Matthew Wilcox wrote:
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?
Not if there is a bug and someone passes RMAP_EXCLUSIVE for these. :)
Fortunately, we do have
VM_BUG_ON_PGFLAGS(!PageAnon(page) || PageKsm(page), page);
in SetPageAnonExclusive() to catch such bugs.
Maybe better to move these last two lines inside the previous test,
just to avoid the question.
That could end up hiding another BUG, so I'd rather let
SetPageAnonExclusive() catch it.
--
Cheers,
David / dhildenb