[Devel] [TRD] optimization for zero-filled pages written by VMs

Konstantin Khorenko khorenko at virtuozzo.com
Fri Sep 8 12:25:03 MSK 2017


On 09/08/2017 11:04 AM, Roman Kagan wrote:
> On Thu, Sep 07, 2017 at 04:41:11PM +0300, Konstantin Khorenko wrote:
>> 1. Feature
>>
>> Optimization for zero-filled pages written by VMs
>> https://jira.sw.ru/browse/PSBM-64658
>>
>> 2. Description
>>
>> Any page before being written to the physical swap is checked if it is filled
>> by zeroes and mapped to a zero page in this case instead of actual swap out.
>>
>> The feature is implemented on the tswap level, so the page is checked for zeroes
>> before putting to tswap.
>
> 1) why is it an improvement over KSM?

It's not, it's an addition for a case of massive Windows VM start when KSM is unable to merge all memory quickly.
+ we enable/disable KSM daemon dynamically, so we have more cases when KSM does not have enough time to merge all pages.

> 2) IIUC zero detection happens at reclaim time.  Isn't it too late?
>    Shouldn't the goal be to avoid triggering reclaim at all?

This is a task for asynchronous KSM. If we all those checks on each reclaim synchronously - it will degrade the performance significantly.

> 3) doesn't the regular Linux reclaimer test for zeroes?

nope

> 4) (and what is tswap BTW?)

https://jira.sw.ru/browse/PSBM-32063

     Transcendent swap cache (tswap) is a simple driver for frontswap, which
     stores reclaimed pages in memory unmodified. Its purpose is to adopt
     pages evicted from a memory cgroup on local pressure, so that they can
     be fetched back later without costly disk accesses. It works similarly
     to shadow gangs from PCS6 except pages has to be copied on eviction.

     Tswap pages are reclaimed on global pressure in the LRU order using the
     shrinker API. Upon eviction a tswap page is copied back to the swap
     cache and writeback is initiated.

     * Usage

      - To disable the frontswap backend, pass tswap.enabled=0 at boot.
      - To activate/deactivate tswap, write Y/N to
        /sys/module/tswap/parameters/active
      - To get the number of pages cached, read
        /sys/module/tswap/parameters/nr_pages

>> Usecase when the feature is expected to provide most performance boost: many
>> Windows-based VMs started simultaneously on a Hardware Node with overcommit
>> => on any restart of an overcommitted HN which runs Windows-based VMs.
>>
>> Windows-based VMs are chosen here because Windows is known to rewrite its RAM
>> with zeroes on boot and lazily while it is running.
>
> Thanks,
> Roman.
> .
>


More information about the Devel mailing list