ksm: remove unswappable max_kernel_pages
Now that ksm pages are swappable, and the known holes plugged, remove mention of unswappable kernel pages from KSM documentation and comments. Remove the totalram_pages/4 initialization of max_kernel_pages. In fact, remove max_kernel_pages altogether - we can reinstate it if removal turns out to break someone's script; but if we later want to limit KSM's memory usage, limiting the stable nodes would not be an effective approach. Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk> Cc: Izik Eidus <ieidus@redhat.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Chris Wright <chrisw@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
62b61f611e
commit
d0f209f68f
3 changed files with 10 additions and 55 deletions
|
@ -16,9 +16,9 @@ by sharing the data common between them. But it can be useful to any
|
|||
application which generates many instances of the same data.
|
||||
|
||||
KSM only merges anonymous (private) pages, never pagecache (file) pages.
|
||||
KSM's merged pages are at present locked into kernel memory for as long
|
||||
as they are shared: so cannot be swapped out like the user pages they
|
||||
replace (but swapping KSM pages should follow soon in a later release).
|
||||
KSM's merged pages were originally locked into kernel memory, but can now
|
||||
be swapped out just like other user pages (but sharing is broken when they
|
||||
are swapped back in: ksmd must rediscover their identity and merge again).
|
||||
|
||||
KSM only operates on those areas of address space which an application
|
||||
has advised to be likely candidates for merging, by using the madvise(2)
|
||||
|
@ -44,20 +44,12 @@ includes unmapped gaps (though working on the intervening mapped areas),
|
|||
and might fail with EAGAIN if not enough memory for internal structures.
|
||||
|
||||
Applications should be considerate in their use of MADV_MERGEABLE,
|
||||
restricting its use to areas likely to benefit. KSM's scans may use
|
||||
a lot of processing power, and its kernel-resident pages are a limited
|
||||
resource. Some installations will disable KSM for these reasons.
|
||||
restricting its use to areas likely to benefit. KSM's scans may use a lot
|
||||
of processing power: some installations will disable KSM for that reason.
|
||||
|
||||
The KSM daemon is controlled by sysfs files in /sys/kernel/mm/ksm/,
|
||||
readable by all but writable only by root:
|
||||
|
||||
max_kernel_pages - set to maximum number of kernel pages that KSM may use
|
||||
e.g. "echo 100000 > /sys/kernel/mm/ksm/max_kernel_pages"
|
||||
Value 0 imposes no limit on the kernel pages KSM may use;
|
||||
but note that any process using MADV_MERGEABLE can cause
|
||||
KSM to allocate these pages, unswappable until it exits.
|
||||
Default: quarter of memory (chosen to not pin too much)
|
||||
|
||||
pages_to_scan - how many present pages to scan before ksmd goes to sleep
|
||||
e.g. "echo 100 > /sys/kernel/mm/ksm/pages_to_scan"
|
||||
Default: 100 (chosen for demonstration purposes)
|
||||
|
@ -75,7 +67,7 @@ run - set 0 to stop ksmd from running but keep merged pages,
|
|||
|
||||
The effectiveness of KSM and MADV_MERGEABLE is shown in /sys/kernel/mm/ksm/:
|
||||
|
||||
pages_shared - how many shared unswappable kernel pages KSM is using
|
||||
pages_shared - how many shared pages are being used
|
||||
pages_sharing - how many more sites are sharing them i.e. how much saved
|
||||
pages_unshared - how many pages unique but repeatedly checked for merging
|
||||
pages_volatile - how many pages changing too fast to be placed in a tree
|
||||
|
@ -87,4 +79,4 @@ pages_volatile embraces several different kinds of activity, but a high
|
|||
proportion there would also indicate poor use of madvise MADV_MERGEABLE.
|
||||
|
||||
Izik Eidus,
|
||||
Hugh Dickins, 24 Sept 2009
|
||||
Hugh Dickins, 17 Nov 2009
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue