Re: [RFC PATCH v1 0/4] mm: port MADV_VOLATILE and MADV_NONVOLATILE to v7.3-rc1

From
Lorenzo Stoakes (ARM) <ljs@kernel.org>
Date
2026-11-30 18:18:27
Also in
cgroups, linux-arch, linux-fsdevel, linux-mm, linux-trace-kernel, lkml
Reply to
David Hildenbrand (Arm), 2026-11-30
On Mon, Nov 30, 2026 at 11:39:45AM +0100, David Hildenbrand (Arm) wrote:
On 11/30/26 09:34, Hirotaka Yamagata wrote:

Hi,
quoted
This RFC series revives and modernizes the volatile ranges patchset
originally proposed by John Stultz and Minchan Kim [1].

Volatile ranges allow userspace caches holding regenerable data (such as
decoded image bitmaps or other private caches) to mark private anonymous
memory as safe for the kernel to discard under memory pressure,
bypassing swap. Such ranges are marked via madvise(MADV_VOLATILE).
Before reusing the buffer, userspace calls madvise(MADV_NONVOLATILE),
which unmarks the range and returns 1 if any pages in the range were
purged while volatile (or 0 if all pages remained intact).
We have MAP_DROPPABLE nowadays, I don't think we want more of that.
Yes exactly.

And also absolutely no to this pattern of:

1. Create an unnecessary new file for something
2. Redirect an MADV_xxx to that file, maybe some hooks
3. ???
4. the control of what the MADV_xxx does sits outside of madvise now.
quoted
Unlike MADV_FREE, which silently zero-fills dropped pages on re-access,
calling MADV_NONVOLATILE before reuse gives userspace deterministic
notification of whether cached data was lost without having to touch
every page.
We do have userfaultfd missing faults + rwp (read-write-protection). Can't we
build something based on that instead?

We currently disable uffd with MAP_DROPPABLE, but maybe there could be a use
case for it. Of course, you can also build it based on MADV_FREE instead.
Well we'd need to have a compelling reason to combine the two I think :P

But in general agree with - check to see what tooling there is already before
making a big, invasive change to mm.

--
Cheers, Lorenzo
Thread (9 messages) 9 messages, 4 authors, last reply 1d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help