Re: [PATCH v2] ksm: allow dedup all tasks memory

From: Matthew Wilcox
Date: Sun Nov 11 2018 - 22:58:41 EST


On Mon, Nov 12, 2018 at 12:26:10AM +0300, Timofey Titovets wrote:
> ksm by default working only on memory that added by
> madvice().
>
> And only way get that work on other applications:
> - Use LD_PRELOAD and libraries
> - Patch kernel
>
> Lets use kernel task list in ksm_scan_thread and add logic to allow ksm
> import VMA from tasks.
> That behaviour controlled by new attribute: mode
> I try mimic hugepages attribute, so mode have two states:
> - normal - old default behaviour
> - always [new] - allow ksm to get tasks vma and try working on that.
>
> To reduce CPU load & tasklist locking time,
> ksm try import VMAs from one task per loop.
>
> So add new attribute "mode"
> Two passible values:
> - normal [default] - ksm use only madvice
> - always [new] - ksm will search vma over all processes memory and
> add it to the dedup list

Do you have any numbers for how much difference this change makes with
various different workloads?