linux-imx/Documentation/ABI/testing/sysfs-kernel-mm-ksm
Stefan Roesch d21077fbc2 mm: add new KSM process and sysfs knobs
This adds the general_profit KSM sysfs knob and the process profit metric
knobs to ksm_stat.

1) expose general_profit metric

   The documentation mentions a general profit metric, however this
   metric is not calculated.  In addition the formula depends on the size
   of internal structures, which makes it more difficult for an
   administrator to make the calculation.  Adding the metric for a better
   user experience.

2) document general_profit sysfs knob

3) calculate ksm process profit metric

   The ksm documentation mentions the process profit metric and how to
   calculate it.  This adds the calculation of the metric.

4) mm: expose ksm process profit metric in ksm_stat

   This exposes the ksm process profit metric in /proc/<pid>/ksm_stat.
   The documentation mentions the formula for the ksm process profit
   metric, however it does not calculate it.  In addition the formula
   depends on the size of internal structures.  So it makes sense to
   expose it.

5) document new procfs ksm knobs

Link: https://lkml.kernel.org/r/20230418051342.1919757-3-shr@devkernel.io
Signed-off-by: Stefan Roesch <shr@devkernel.io>
Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Rik van Riel <riel@surriel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-04-21 14:52:03 -07:00

2.0 KiB

What: /sys/kernel/mm/ksm Date: September 2009 KernelVersion: 2.6.32 Contact: Linux memory management mailing list linux-mm@kvack.org Description: Interface for Kernel Samepage Merging (KSM)

What: /sys/kernel/mm/ksm/full_scans What: /sys/kernel/mm/ksm/pages_shared What: /sys/kernel/mm/ksm/pages_sharing What: /sys/kernel/mm/ksm/pages_to_scan What: /sys/kernel/mm/ksm/pages_unshared What: /sys/kernel/mm/ksm/pages_volatile What: /sys/kernel/mm/ksm/run What: /sys/kernel/mm/ksm/sleep_millisecs Date: September 2009 Contact: Linux memory management mailing list linux-mm@kvack.org Description: Kernel Samepage Merging daemon sysfs interface

	full_scans: how many times all mergeable areas have been
	scanned.

	pages_shared: how many shared pages are being used.

	pages_sharing: how many more sites are sharing them i.e. how
	much saved.

	pages_to_scan: how many present pages to scan before ksmd goes
	to sleep.

	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.

	run: write 0 to disable ksm, read 0 while ksm is disabled.

		- write 1 to run ksm, read 1 while ksm is running.
		- write 2 to disable ksm and unmerge all its pages.

	sleep_millisecs: how many milliseconds ksm should sleep between
	scans.

	See Documentation/mm/ksm.rst for more information.

What: /sys/kernel/mm/ksm/merge_across_nodes Date: January 2013 KernelVersion: 3.9 Contact: Linux memory management mailing list linux-mm@kvack.org Description: Control merging pages across different NUMA nodes.

	When it is set to 0 only pages from the same node are merged,
	otherwise pages from all nodes can be merged together (default).

What: /sys/kernel/mm/ksm/general_profit Date: April 2023 KernelVersion: 6.4 Contact: Linux memory management mailing list linux-mm@kvack.org Description: Measure how effective KSM is. general_profit: how effective is KSM. The formula for the calculation is in Documentation/admin-guide/mm/ksm.rst.