[RFC 5/5] Docs/cgroup-v2: add cgroup.memsw_account_on_dfl Documentation

From: Jingxiang Zeng
Date: Wed Mar 19 2025 - 02:44:56 EST


From: Zeng Jingxiang <linuszeng@xxxxxxxxxxx>

Add documentation descriptions for cgroup.memsw_account_on_dfl and
CONFIG_MEMSW_ACCOUNT_ON_DFL.

Signed-off-by: Zeng Jingxiang <linuszeng@xxxxxxxxxxx>
---
Documentation/admin-guide/cgroup-v2.rst | 21 +++++++++++++++----
.../admin-guide/kernel-parameters.txt | 7 +++++++
2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst
index 53ada5c2620a..58869279f0a9 100644
--- a/Documentation/admin-guide/cgroup-v2.rst
+++ b/Documentation/admin-guide/cgroup-v2.rst
@@ -1704,8 +1704,14 @@ The following nested keys are defined.
A read-only single value file which exists on non-root
cgroups.

- The total amount of swap currently being used by the cgroup
- and its descendants.
+ If memsw_account_on_dfl and CONFIG_MEMSW_ACCOUNT_ON_DFL is not
+ enabled (the default), this interface represents the total
+ amount of swap currently being used by the cgroup and its
+ descendants.
+
+ If memsw_account_on_dfl or CONFIG_MEMSW_ACCOUNT_ON_DFL is enabled,
+ this interface represents the total amount of memory+swap
+ currently being used by the cgroup and its descendants.

memory.swap.high
A read-write single value file which exists on non-root
@@ -1737,8 +1743,15 @@ The following nested keys are defined.
A read-write single value file which exists on non-root
cgroups. The default is "max".

- Swap usage hard limit. If a cgroup's swap usage reaches this
- limit, anonymous memory of the cgroup will not be swapped out.
+ If memsw_account_on_dfl and CONFIG_MEMSW_ACCOUNT_ON_DFL is not
+ enabled (the default), this interface represents the hard limit
+ of swap usage. If a cgroup's swap usage reaches this limit,
+ anonymous memory of the cgroup will not be swapped out.
+
+ If memsw_account_on_dfl or CONFIG_MEMSW_ACCOUNT_ON_DFL is enabled,
+ this interface represents the hard limit of memory+swap usage.
+ If a cgroup's memory+swap usage reaches this limit, anonymous
+ memory of the cgroup will not be swapped out.

memory.swap.max.effective
A read-only single value file which exists on non-root cgroups.
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 2758bc124f16..0aa9e4f85b51 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -644,6 +644,13 @@
nokmem -- Disable kernel memory accounting.
nobpf -- Disable BPF memory accounting.

+ cgroup.memsw_account_on_dfl= [KNL] Enable memory+swap account on cgroupv2.
+ Format: { "0" | "1" }
+ 0 - memory.swap.current and memory.swap.max represents the
+ usage/limit of swap.
+ 1 - memory.swap.current and memory.swap.max represents the
+ usage/limit of memory+swap.
+
checkreqprot= [SELINUX] Set initial checkreqprot flag value.
Format: { "0" | "1" }
See security/selinux/Kconfig help text.
--
2.41.1