# Re: \[RFC PATCH v1 0/4\] mm: port MADV\_VOLATILE and MADV\_NONVOLATILE to v7.3-rc1

- From: David Hildenbrand (Arm) \<david@kernel.org\>
- Date: 2026-11-30 10:39:55 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2026/11/18049643
- Thread: https://ratatoskr.run/linux-api/2026/11/18048701/t.md

```text
On 11/30/26 09:34, Hirotaka Yamagata wrote:

Hi,

> 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.

> 
> 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.

-- 
Cheers,

David
```
