Re: [PATCH RFC] mm/madvise: introduce MADV_POPULATE to prefault/prealloc memory

David Hildenbrand
2021-02-22T12:55:05Z

On 22.02.21 13:46, Michal Hocko wrote:
> I am slowly catching up with this thread.
>
> On Fri 19-02-21 09:20:16, David Hildenbrand wrote:
> [...]
>> So if we have zero, we write zero. We'll COW pages, triggering a write fault
>> - and that's the only good thing about it. For example, similar to
>> MADV_POPULATE, nothing stops KSM from merging anonymous pages again. So for
>> anonymous memory the actual write is not helpful at all. Similarly for
>> hugetlbfs, the actual write is not necessary - but there is no other way to
>> really achieve the goal.
>
> I really do not see why you care about KSM so much. Isn't KSM an
> explicit opt-in with a fine grained interface to control which memory to
> KSM or not?

Yeah, I think it's opt-in via MADV_MERGEABLE. E.g., QEMU defaults to
enable KSM unless explicitly disabled by the user.

But I agree, I got distracted by KSM details.

--
Thanks,

David / dhildenb