On Tue, Dec 12, 2023 at 01:26:35PM +0100, David Hildenbrand wrote: > On 11.12.23 17:22, Matthew Wilcox (Oracle) wrote: > > We should only see anon folios in this function (and there are many > > assumptions of that already), so we can simplify these two assertions. > > If we swapped in a fresh page, it is not PageAnon before we do the > page_add_anon_rmap() call. > > So I'm pretty sure this is wrong. Argh, yes. What do you think to just dropping the assertions altogether? You added them in 78fbe906cc90 as part of general paranoia about using an existing flag for a new purpose. I think they've now served their purpose and can go away. Perhaps simply: VM_BUG_ON_PAGE(PageAnonExclusive(page), page);