@@ -203,21 +203,25 @@ several times, which are unprofitable memory consumed.
203
203
1) How to determine whether KSM save memory or consume memory in system-wide
204
204
range? Here is a simple approximate calculation for reference::
205
205
206
- general_profit =~ pages_sharing * sizeof(page) - (all_rmap_items) *
206
+ general_profit =~ ksm_saved_pages * sizeof(page) - (all_rmap_items) *
207
207
sizeof(rmap_item);
208
208
209
- where all_rmap_items can be easily obtained by summing ``pages_sharing ``,
210
- ``pages_shared ``, ``pages_unshared `` and ``pages_volatile ``.
209
+ where ksm_saved_pages equals to the sum of ``pages_sharing `` +
210
+ ``ksm_zero_pages `` of the system, and all_rmap_items can be easily
211
+ obtained by summing ``pages_sharing ``, ``pages_shared ``, ``pages_unshared ``
212
+ and ``pages_volatile ``.
211
213
212
214
2) The KSM profit inner a single process can be similarly obtained by the
213
215
following approximate calculation::
214
216
215
- process_profit =~ ksm_merging_pages * sizeof(page) -
217
+ process_profit =~ ksm_saved_pages * sizeof(page) -
216
218
ksm_rmap_items * sizeof(rmap_item).
217
219
218
- where ksm_merging_pages is shown under the directory ``/proc/<pid>/ ``,
219
- and ksm_rmap_items is shown in ``/proc/<pid>/ksm_stat ``. The process profit
220
- is also shown in ``/proc/<pid>/ksm_stat `` as ksm_process_profit.
220
+ where ksm_saved_pages equals to the sum of ``ksm_merging_pages `` and
221
+ ``ksm_zero_pages ``, both of which are shown under the directory
222
+ ``/proc/<pid>/ksm_stat ``, and ksm_rmap_items is also shown in
223
+ ``/proc/<pid>/ksm_stat ``. The process profit is also shown in
224
+ ``/proc/<pid>/ksm_stat `` as ksm_process_profit.
221
225
222
226
From the perspective of application, a high ratio of ``ksm_rmap_items `` to
223
227
``ksm_merging_pages `` means a bad madvise-applied policy, so developers or
0 commit comments