[PATCH v3 7/7] docs: numa: Add documentation for demotion

Jagdish Gediya
2022-04-22T22:03:19Z

Add documentation for demotion mentioning about why is it
required and all the sysfs interfaces available related to
demotion.

Signed-off-by: Jagdish Gediya <jvgediya@linux.ibm.com>
---
Documentation/admin-guide/mm/index.rst | 1 +
.../admin-guide/mm/numa_demotion.rst | 57 +++++++++++++++++++
2 files changed, 58 insertions(+)
create mode 100644 Documentation/admin-guide/mm/numa_demotion.rst

diff --git a/Documentation/admin-guide/mm/index.rst b/Documentation/admin-guide/mm/index.rst
index c21b5823f126..4bd0ed3de9c5 100644
--- a/Documentation/admin-guide/mm/index.rst
+++ b/Documentation/admin-guide/mm/index.rst
@@ -34,6 +34,7 @@ the Linux memory management.
memory-hotplug
nommu-mmap
numa_memory_policy
+ numa_demotion
numaperf
pagemap
soft-dirty
diff --git a/Documentation/admin-guide/mm/numa_demotion.rst b/Documentation/admin-guide/mm/numa_demotion.rst
new file mode 100644
index 000000000000..252be9dc0517
--- /dev/null
+++ b/Documentation/admin-guide/mm/numa_demotion.rst
@@ -0,0 +1,57 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+==================
+NUMA Demotion
+==================
+
+What is demotion required?
+============================
+
+With the advent of various new memory types, Systems have multiple
+types of memory, e.g. DRAM and PMEM (persistent memory). The memory
+subsystem of such systems can be called memory tiering system,
+because the performance of the different types of memory are usually
+different.
+
+In a system with some DRAM and some persistent memory, once DRAM
+fills up, reclaim will start and some of the DRAM contents will be
+thrown out to swap even if there is space in persistent memory.
+Allocations will, at some point, start falling over to the slower
+persistent memory.
+
+Instead of page being discarded during reclaim, it can be moved to
+persistent memory. Allowing page migration during reclaim enables
+these systems to migrate pages from fast tiers to slow tiers when
+the fast tier is under pressure.
+
+SYSFS interface
+======================
+
+Enable/Disable demotion
+------------------------
+
+By default demotion is disabled, it can be enabled/disabled using below
+sysfs interface,
+
+echo 0/1 or false/true > /sys/kernel/mm/numa/demotion_enabled
+
+Read system demotion targets
+-----------------------------
+cat /sys/devices/system/node/demotion_targets
+
+Kernel shows node_states[N_DEMOTION_TARGETS] when this command
+is run.
+
+Override default demotion targets
+---------------------------------
+echo <nodelist> > /sys/devices/system/node/demotion_targets
+
+If nodelist is valid and subset of N_MEMORY then
+node_states[N_DEMOTION_TARGETS] is set to this new nodelist, and
+kernel builds the new demotion list based on it.
+
+Read per node demotion targets
+-------------------------------
+cat /sys/devices/system/node/nodeX/demotion_targets
+
+It shows per node demotion targets configured by kernel.
--
2.35.1