Skip to content

Commit

Permalink
mm: Add transformation message for per-memcg swappiness
Browse files Browse the repository at this point in the history
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/1577252208-32419-1-git-send-email-teawater@gmail.com/
Signed-off-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Michal Koutný authored and Tejun Heo committed Mar 11, 2025
1 parent 103149a commit fd4fd0a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions Documentation/admin-guide/cgroup-v1/memory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Brief summary of control files.
used.
memory.swappiness set/show swappiness parameter of vmscan
(See sysctl's vm.swappiness)
Per memcg knob does not exist in cgroup v2.
memory.move_charge_at_immigrate This knob is deprecated.
memory.oom_control set/show oom controls.
This knob is deprecated and shouldn't be
Expand Down
6 changes: 4 additions & 2 deletions mm/memcontrol-v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1855,9 +1855,11 @@ static int mem_cgroup_swappiness_write(struct cgroup_subsys_state *css,
if (val > MAX_SWAPPINESS)
return -EINVAL;

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

return 0;
Expand Down

0 comments on commit fd4fd0a

Please sign in to comment.