Re: [PATCH] mm/rmap: Add anon_vma lifetime debug check
From: Jann Horn
Date: Fri Jul 25 2025 - 07:25:42 EST
On Fri, Jul 25, 2025 at 1:12 PM David Hildenbrand <david@xxxxxxxxxx> wrote:
> On 25.07.25 13:08, Jann Horn wrote:
> > On Thu, Jul 24, 2025 at 11:56 PM David Hildenbrand <david@xxxxxxxxxx> wrote:
> >> 2) We have a folio here, so ... better
> >>
> >> if (folio_test_anon(folio) && !folio_test_ksm(folio)) {
> >> ...
> >> }
> >
> > Hrm, okay. It kind of irks me to write it as two checks when really I
> > want to ask "is it this one specific type", but yeah, will change it.
>
> Well, ksm is a subtype of anon.
I mean... not really? At least ksm folios are not a subtype of normal
anon folios. Normal anon folios point to an anon_vma, a ksm folio
points to a ksm_stable_node instead, and you can't treat a
ksm_stable_node as an anon_vma.