Re: [RFC PATCH 0/2] SKSM: Synchronous Kernel Samepage Merging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2025-02-28 10:10, David Hildenbrand wrote:
[...]
For example, QEMU will mark all guest memory is mergeable using MADV, to limit the deduplicaton to guest RAM only.


On a related note, I think the madvise(2) documentation is inaccurate.

It states:

       MADV_MERGEABLE (since Linux 2.6.32)
              Enable  Kernel Samepage Merging (KSM) for the pages in the range
              specified by addr and length. [...]

AFAIU, based on code review of ksm_madvise(), this is not strictly true.

The KSM implementation enables KSM for pages in the entire vma containing the range.
So if it so happens that two mmap areas with identical protection flags are merged,
both will be considered mergeable by KSM as soon as at least one page from any of
those areas is made mergeable.

This does not appear to be an issue in qemu because guard pages with different
protection are placed between distinct mappings, which should prevent combining
the vmas.

Thanks,

Mathieu

--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux