mm: LKSM: new feature: use filter-based scanning to reduce scanning cost 98/239598/15
authorSung-hun Kim <sfoon.kim@samsung.com>
Thu, 16 Jul 2020 06:58:28 +0000 (15:58 +0900)
committerDongwoo Lee <dwoo08.lee@samsung.com>
Wed, 12 Aug 2020 08:01:13 +0000 (08:01 +0000)
commit40e053c0beaac8aa681976fd551a74936254a63b
tree59d833b6bb028f334faf05c12b2a1f0185474369
parent323d1b6d7b3851aa7384ba254ef0b4f171a583b9
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