Re: [PATCH v3] mm/ksm: introduce ksm_force for each process

From: Andrew Morton
Date: Sat May 07 2022 - 13:59:38 EST


On Sat, 7 May 2022 05:47:02 +0000 cgel.zte@xxxxxxxxx wrote:

> To use KSM, we must explicitly call madvise() in application code,
> which means installed apps on OS needs to be uninstall and source
> code needs to be modified. It is inconvenient.
>
> In order to change this situation, We add a new proc 'ksm_force'
> under /proc/<pid>/ to support turning on/off KSM scanning of a
> process's mm dynamically.
>
> If ksm_force is set as 1, force all anonymous and 'qualified' vma
> of this mm to be involved in KSM scanning without explicitly
> calling madvise to make vma MADV_MERGEABLE. But It is effctive only
> when the klob of '/sys/kernel/mm/ksm/run' is set as 1.
>
> If ksm_enale is set as 0, cancel the feature of ksm_force of this
> process and unmerge those merged pages which is not madvised as
> MERGEABLE of this process, but leave MERGEABLE areas merged.
>

There are quite a lot of typos here. Please proof-read it.

> fs/proc/base.c | 99 ++++++++++++++++++++++++++++++++++++++++
> include/linux/mm_types.h | 9 ++++
> mm/ksm.c | 32 ++++++++++++-

And please update the appropriate places under Documentation/ - all
user-facing interfaces should be well documented.