Skip to content

Commit fd4fd0a

Browse files
Werkovhtejun
authored andcommitted
mm: Add transformation message for per-memcg swappiness
The concept of per-memcg swappiness has never landed well in memcg for cgroup v2. Add a message to users who use it on v1 hierarchy. Decreased swappiness transforms to memory.swap.max=0 whereas increased swappiness transforms into active memory.reclaim operation. Link: https://lore.kernel.org/r/[email protected]/ Signed-off-by: Michal Koutný <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 103149a commit fd4fd0a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Documentation/admin-guide/cgroup-v1/memory.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Brief summary of control files.
9090
used.
9191
memory.swappiness set/show swappiness parameter of vmscan
9292
(See sysctl's vm.swappiness)
93+
Per memcg knob does not exist in cgroup v2.
9394
memory.move_charge_at_immigrate This knob is deprecated.
9495
memory.oom_control set/show oom controls.
9596
This knob is deprecated and shouldn't be

mm/memcontrol-v1.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,9 +1855,11 @@ static int mem_cgroup_swappiness_write(struct cgroup_subsys_state *css,
18551855
if (val > MAX_SWAPPINESS)
18561856
return -EINVAL;
18571857

1858-
if (!mem_cgroup_is_root(memcg))
1858+
if (!mem_cgroup_is_root(memcg)) {
1859+
pr_info_once("Per memcg swappiness does not exist in cgroup v2. "
1860+
"See memory.reclaim or memory.swap.max there\n ")
18591861
WRITE_ONCE(memcg->swappiness, val);
1860-
else
1862+
} else
18611863
WRITE_ONCE(vm_swappiness, val);
18621864

18631865
return 0;

0 commit comments

Comments
 (0)