Re: [RFC 1/1] mm/madvise: fail MADV_PAGEOUT on VM_DROPPABLE VMA

From: David Hildenbrand
Date: Mon Jan 20 2025 - 08:57:10 EST


On 20.01.25 14:47, Lance Yang wrote:
Hi Barry, David and Lorenzo,

Thanks a lot for taking time to review!

On Mon, Jan 20, 2025 at 6:45 PM Lorenzo Stoakes
<lorenzo.stoakes@xxxxxxxxxx> wrote:

Sorry but NACK again on this :(

On Mon, Jan 20, 2025 at 09:30:38AM +0800, Lance Yang wrote:
MADV_PAGEOUT should fail on VMAs with the VM_DROPPABLE flag. While
MADV_PAGEOUT is intended to move anonymous pages to swap, VM_DROPPABLE
should not be swapped out.

There is an issue where using MADV_PAGEOUT on a VMA with the VM_DROPPABLE
flag behaves like MADV_DONTNEED, causing the pages to be dropped. This
could break the semantics of MADV_PAGEOUT, IMO.

So, let's add a check to detect the VM_DROPPABLE flag before doing
MADV_PAGEOUT and returns -EINVAL.

No, let's not.

I think I completely got it wrong. Learning so much from your patient responses!

Maybe you can make the documentation (man pages?) clearer in that regard? Thanks!

--
Cheers,

David / dhildenb