On Thu, Jul 24, 2025 at 2:53 PM David Hildenbrand <[email protected]> wrote: > > > > >> 4. We could ask applications to switch to non-destructive madvise, > >> like MADV_COLD or MADV_PAGEOUT. Or, another option is that we could > >> switch the kernel to use non-destructive madvise implicitly for > >> destructive madvise in suitable situations. > > > > Umm what? I don't understand your point. > > > >> 5. We could investigate more based on vma->anon_vma > > > > I have no idea what you mean by this. I am an rmap maintainer and have > > worked extensively with anon_vma, what's the point exactly? > > I think, the idea would be to add an additional anon_vma check: so if > you have a MAP_PRIVATE file mapping, you could still allow for > MADV_DONTNEED if you are sure that there are no anon folios in there. > Yes. That is the theory, thanks for clarifying it for me. This is exactly what I was trying to say in my previous response:
"We could try having destructive madvise check vma->anon_vma and reject the call if it's true. I haven't had a chance to test this theory yet, though." > If there is an anon_vma, the only way to find out is actually looking at > the page tables. > > To be completely precise, one would have to enlighten the zap logic to > refuse to zap if there is any anon folio there, and bail out. > > -- > Cheers, > > David / dhildenb >
