
pksm
PKSM中文介绍 (如果需要商业用途,建议使用UKSM)
News
Apr 18, 2013
PKSM 0.2 is released. This is a new development release. It is experiment code now, if you want to use KSM for commercial usage, pls try UKSM.
Apr 11, 2013
The famous open source website Phoronix had reported PKSM.
March 29, 2013
PKSM 0.1 is released. This is a new development release. It is experiment code now.
March 14, 2013
PKSM 0.0.9 is released. This is a new development release.
Motivation - Why PKSM (Anon-page KSM) ?
KSM/UKSM scan all of the VMA areas in memory sub-system and traversing VMAs to find a valid Anon-Page, in my point of view, it was not effective for memory merging, because of it have wasting a lot of CPU. So I creating a new project that want to improving the performance of the memory merging in Linux System. It will use a new algorithm and mechanism that it directly handle the Anon-pages that it was created/freed by the linux kernel. It is no need to waster CPU time to traversing all of the VMA areas to find valid anon-pages. It is also transparent for user. It will be more faster and more effective especially that have huge memory computer such as virtualization. It will be more competive when apply for the virtualization/clould production.
PKSM is just another approach implementation for KSM , and experiment code for anon-page merging. Donot use it for commercial usage. If you want to use KSM, pls try UKSM
What is KSM?
KSM(Kernel Samepage Merging) is a memory-saving de-duplication feature, that merges anonymous (private) pages (not pagecache ones). KSM only operates on those areas of address space which an application has advised to be likely candidates for merging, by using the madvise system call. The concept of shared memory is common in modern operating systems. For example, when a program is first started it shares all of its memory with the parent program. When either the child or parent program tries to modify this memory, the kernel allocates a new memory region, copies the original contents and allows the program to modify this new region. This is known as copy on write.
KSM is a new Linux feature which uses this concept in reverse. KSM enables the kernel to examine two or more already running programs and compare their memory. If any memory regions or pages are identical, KSM reduces multiple references to multiple identical memory pages to a single reference to a single page. This page is then marked copy on write. If the contents of the page is modified, a new page is created.
What is UKSM?
UKSM: (Ultra KSM) the patch-set for the Linux kernel continues to be maintained for providing transparent full-system memory de-duplication for Linux. UKSM is created and leaded by Xia Nai who is a professor at NanJing University。 It has a lot of users for linux server and clustering/clould compute system. Some linux distrubutions like StartOS/zen-kernel have pre-installed UKSM by default。
Homepage:http://kerneldedup.org/
New Feature for PKSM
(PKSM is an improvement upon KSM/UKSM. Some basic data structures and routines are borrowed from ksm.c and uksm.c.)
1. Transparent for user
It automatically add all user processes' anonymous pages to PKSM. It no need submit a memory area to KSM from user applications.
2. High effective for anonymous page detection
It automatically detects anonymous page is created and freed, It will use a new algorithm and mechanism that it directly handle the anonymous page when it be created/freed by the linux kernel. It is no need to waster CPU time to traversing all of the VMA areas to find valid anonymous pages. KSM/UKSM will waster a lot of CPU time to traversing VMAs to find a valid anonymous page, PKSM no need considering it.
3. Full Zero Page consideration
Now pksmd consider full zero pages as special pages and merge them to an special unswappable pksm zero page. (Borrowed from UKSM)
4. Check page content periodically
Pksm considers unstable page contents are volatile, which are add the a FIFO list. It check page content by a hash value periodically. The default scanning cycles is 20 minutes.
Release
March 14, 2013
PKSM 0.0.9 is released. This is a new development release.
HowTo
Install
If your system use the Linux kernel that is built by yourself, you can download the PKSM patch and enable the PKSM feature and re-build it.
``` [figo@figo linux-3.6]$ make menuconfig
Processor type and features---> [*] Enable KSM for page merging Choose PKSM/KSM strategy (AnonPage-KSM for page merging) ---> (X) AnonPage-KSM for page merging ```
ArchLinux
you can install by AUR. https://aur.archlinux.org/packages/linux-pksm/
Howto use
PKSM的相关控制参数和统计信息在以下目录中: /sys/kernel/mm/pksm * run 控制内核线程pksmd是否开启。缺省是开启的,如果你想关闭可以:echo 0 > run * pages_shared 有多少个不同的物理页面处在被共享的状态 * pages_sharing 有多少个虚拟页面指向以上的共享页面,差不多可以等效看作你节省的内存。 * page_zero_sharing 有多少个零页面被共享
- 您还可以通过/proc/meminfo信息查看到PKSM为您节省了多少物理内存。
[figo@figo ~]$ cat /proc/meminfo
KsmSharingPages: 45924 kB
Contact
Figo.zhang
Project Information
The project was created on Jan 29, 2013.
- License: GNU GPL v2
- 7 stars
- git-based source control