diff options
Diffstat (limited to 'Documentation/vm')
-rw-r--r-- | Documentation/vm/ksm.txt | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/Documentation/vm/ksm.txt b/Documentation/vm/ksm.txt index 262d8e6793a3..b392e496f816 100644 --- a/Documentation/vm/ksm.txt +++ b/Documentation/vm/ksm.txt | |||
@@ -16,9 +16,9 @@ by sharing the data common between them. But it can be useful to any | |||
16 | application which generates many instances of the same data. | 16 | application which generates many instances of the same data. |
17 | 17 | ||
18 | KSM only merges anonymous (private) pages, never pagecache (file) pages. | 18 | KSM only merges anonymous (private) pages, never pagecache (file) pages. |
19 | KSM's merged pages are at present locked into kernel memory for as long | 19 | KSM's merged pages were originally locked into kernel memory, but can now |
20 | as they are shared: so cannot be swapped out like the user pages they | 20 | be swapped out just like other user pages (but sharing is broken when they |
21 | replace (but swapping KSM pages should follow soon in a later release). | 21 | are swapped back in: ksmd must rediscover their identity and merge again). |
22 | 22 | ||
23 | KSM only operates on those areas of address space which an application | 23 | KSM only operates on those areas of address space which an application |
24 | has advised to be likely candidates for merging, by using the madvise(2) | 24 | 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), | |||
44 | and might fail with EAGAIN if not enough memory for internal structures. | 44 | and might fail with EAGAIN if not enough memory for internal structures. |
45 | 45 | ||
46 | Applications should be considerate in their use of MADV_MERGEABLE, | 46 | Applications should be considerate in their use of MADV_MERGEABLE, |
47 | restricting its use to areas likely to benefit. KSM's scans may use | 47 | restricting its use to areas likely to benefit. KSM's scans may use a lot |
48 | a lot of processing power, and its kernel-resident pages are a limited | 48 | of processing power: some installations will disable KSM for that reason. |
49 | resource. Some installations will disable KSM for these reasons. | ||
50 | 49 | ||
51 | The KSM daemon is controlled by sysfs files in /sys/kernel/mm/ksm/, | 50 | The KSM daemon is controlled by sysfs files in /sys/kernel/mm/ksm/, |
52 | readable by all but writable only by root: | 51 | readable by all but writable only by root: |
53 | 52 | ||
54 | max_kernel_pages - set to maximum number of kernel pages that KSM may use | ||
55 | e.g. "echo 100000 > /sys/kernel/mm/ksm/max_kernel_pages" | ||
56 | Value 0 imposes no limit on the kernel pages KSM may use; | ||
57 | but note that any process using MADV_MERGEABLE can cause | ||
58 | KSM to allocate these pages, unswappable until it exits. | ||
59 | Default: quarter of memory (chosen to not pin too much) | ||
60 | |||
61 | pages_to_scan - how many present pages to scan before ksmd goes to sleep | 53 | pages_to_scan - how many present pages to scan before ksmd goes to sleep |
62 | e.g. "echo 100 > /sys/kernel/mm/ksm/pages_to_scan" | 54 | e.g. "echo 100 > /sys/kernel/mm/ksm/pages_to_scan" |
63 | Default: 100 (chosen for demonstration purposes) | 55 | Default: 100 (chosen for demonstration purposes) |
@@ -75,7 +67,7 @@ run - set 0 to stop ksmd from running but keep merged pages, | |||
75 | 67 | ||
76 | The effectiveness of KSM and MADV_MERGEABLE is shown in /sys/kernel/mm/ksm/: | 68 | The effectiveness of KSM and MADV_MERGEABLE is shown in /sys/kernel/mm/ksm/: |
77 | 69 | ||
78 | pages_shared - how many shared unswappable kernel pages KSM is using | 70 | pages_shared - how many shared pages are being used |
79 | pages_sharing - how many more sites are sharing them i.e. how much saved | 71 | pages_sharing - how many more sites are sharing them i.e. how much saved |
80 | pages_unshared - how many pages unique but repeatedly checked for merging | 72 | pages_unshared - how many pages unique but repeatedly checked for merging |
81 | pages_volatile - how many pages changing too fast to be placed in a tree | 73 | 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 | |||
87 | proportion there would also indicate poor use of madvise MADV_MERGEABLE. | 79 | proportion there would also indicate poor use of madvise MADV_MERGEABLE. |
88 | 80 | ||
89 | Izik Eidus, | 81 | Izik Eidus, |
90 | Hugh Dickins, 24 Sept 2009 | 82 | Hugh Dickins, 17 Nov 2009 |