mm: LKSM: new feature: use filter-based scanning to reduce scanning cost
authorSung-hun Kim <sfoon.kim@samsung.com>
Thu, 16 Jul 2020 06:58:28 +0000 (15:58 +0900)
committerHoegeun Kwon <hoegeun.kwon@samsung.com>
Wed, 23 Nov 2022 02:23:53 +0000 (11:23 +0900)
commit7bf0235c1af6b496cfde8f11d518f41f63517b09
treedaa70897355246e9a37ced45b86d3cdc05a87f2c
parente4577f6f01d1590efefd4b395e1fd00057fa4a27
mm: LKSM: new feature: use filter-based scanning to reduce scanning cost

LKSM_FILTER is a new feature which is intended to reduce the computation cost.
LKSM_FILTER exploits bitmap-based filters to skip scanning of unnecessary
pages. To this end, LKSM collects addresses of shared pages to make filters.

The rationale of LKSM_FILTER is that user-level programs share common runtime
framework and libraries. Because of that processes can have similar address
space layout. It means that if a page is merged with another page, the same
virtual address in different process can be merged with this merged page.
In this regard, KSM can use a single global filter to cover all sharable areas
in the system.

The challenge is caused by a secure construct of Linux kernel, namely ASLR.
ASLR enforces to have randomized address space for each process, and it
severely disrupts making a global filter.

To overcome this challenge, LKSM exploits two information: regions and offsets.
A region means the physically mapped area. Each process has its own VMAs but
they may mapped same files. A region means the original one.
An address space of a process is randomized in the unit of VMA. It means that
if pages are merged even in the different virtual addresses, there can be at
same offsets from individual VMAs.

LKSM leverages both regions and offsets to construct per-region filters.
By using per-region filters, LKSM could effectively reduce its scanning space
and also computation cost by up to 46% against previous version of LKSM at the
expense of somewhat sharing chances.

Change-Id: I6f010d991b514268a897ce8f7b88fb1442ef39b4
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
mm/Kconfig
mm/lksm.c