[lkml]   [2019]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[PATCH RFC 0/4] mm/ksm: add option to automerge VMAs
By default, KSM works only on memory that is marked by madvise(). And the
only way to get around that is to either:

* use LD_PRELOAD; or
* patch the kernel with something like UKSM or PKSM.

Instead, lets implement a so-called "always" mode, which allows marking
VMAs as mergeable on do_anonymous_page() call automatically.

The submission introduces a new sysctl knob as well as kernel cmdline option
to control which mode to use. The default mode is to maintain old
(madvise-based) behaviour.

Due to security concerns, this submission also introduces VM_UNMERGEABLE
vmaflag for apps to explicitly opt out of automerging. Because of adding
a new vmaflag, the whole work is available for 64-bit architectures only.

This patchset is based on earlier Timofey's submission [1], but it doesn't
use dedicated kthread to walk through the list of tasks/VMAs.

For my laptop it saves up to 300 MiB of RAM for usual workflow (browser,
terminal, player, chats etc). Timofey's submission also mentions
containerised workload that benefits from automerging too.

Open questions:

* once "always" mode is activated, should re-scan of all VMAs be
triggered to find eligible ones for automerging?



Oleksandr Natalenko (4):
mm/ksm: introduce ksm_enter() helper
mm/ksm: introduce VM_UNMERGEABLE
mm/ksm: allow anonymous memory automerging
mm/ksm: add automerging documentation

.../admin-guide/kernel-parameters.txt | 7 +
Documentation/admin-guide/mm/ksm.rst | 7 +
fs/proc/task_mmu.c | 3 +
include/linux/ksm.h | 5 +
include/linux/mm.h | 6 +
include/trace/events/mmflags.h | 7 +
mm/ksm.c | 142 ++++++++++++++----
mm/memory.c | 6 +
8 files changed, 157 insertions(+), 26 deletions(-)


 \ /
  Last update: 2019-05-10 09:22    [W:0.071 / U:26.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site