lkml.org 
[lkml]   [2022]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] mm: madvise: MADV_DONTNEED_LOCKED
From
On 03.03.22 22:47, Johannes Weiner wrote:
> On Thu, Mar 03, 2022 at 04:29:56PM -0500, Johannes Weiner wrote:
>> MADV_DONTNEED historically rejects mlocked ranges, but with
>> MLOCK_ONFAULT and MCL_ONFAULT allowing to mlock without populating,
>> there are valid use cases for depopulating locked ranges as well.

Indeed, there are. I'd have use for that in QEMU for virtio-mem (which
uses MADV_POPULATE_WRITE+MADV_DONTNEED to dynamically allocate/discard
memory in a sparse memory mapping to be used by the VM, currently
doesn't support mlock for obvious reasons).

Further, QEMU postcopy live migration handling requires an munlockall()
before registering the uffd handler and discarding all RAM via
MADV_DONTNEED. Once postcopy finished, we have to mlock() again. I
didn't check if there would be more stopping uffd from working on a
mlocked region, but this would be one piece of the puzzle I guess.

--
Thanks,

David / dhildenb

\
 
 \ /
  Last update: 2022-03-04 14:10    [W:0.123 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site