The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Michal Koutný" <mkoutny@suse.com>
To: cgroups@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: "Michal Koutný" <mkoutny@suse.com>, "Tejun Heo" <tj@kernel.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Michal Hocko" <mhocko@kernel.org>,
	"Roman Gushchin" <roman.gushchin@linux.dev>,
	"Shakeel Butt" <shakeel.butt@linux.dev>,
	"Muchun Song" <muchun.song@linux.dev>,
	"Andrew Morton" <akpm@linux-foundation.org>
Subject: [PATCH v2 08/11] mm: Add transformation message for per-memcg swappiness
Date: Tue, 11 Mar 2025 13:36:25 +0100	[thread overview]
Message-ID: <20250311123640.530377-9-mkoutny@suse.com> (raw)
In-Reply-To: <20250311123640.530377-1-mkoutny@suse.com>

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>
---
 Documentation/admin-guide/cgroup-v1/memory.rst | 1 +
 mm/memcontrol-v1.c                             | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Documentation/admin-guide/cgroup-v1/memory.rst b/Documentation/admin-guide/cgroup-v1/memory.rst
index 286d16fc22ebb..02b8206a35941 100644
--- a/Documentation/admin-guide/cgroup-v1/memory.rst
+++ b/Documentation/admin-guide/cgroup-v1/memory.rst
@@ -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
diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c
index 2be6b9112808c..29ca6489b4ff7 100644
--- a/mm/memcontrol-v1.c
+++ b/mm/memcontrol-v1.c
@@ -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;
-- 
2.48.1


  parent reply	other threads:[~2025-03-11 12:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-11 12:36 [PATCH v2 00/11] cgroup v1 deprecation messages Michal Koutný
2025-03-11 12:36 ` [PATCH v2 01/11] cgroup/cpuset-v1: Add deprecation messages to sched_load_balance and memory_pressure_enabled Michal Koutný
2025-03-11 14:02   ` Waiman Long
2025-03-11 12:36 ` [PATCH v2 02/11] cgroup/cpuset-v1: Add deprecation messages to memory_spread_page and memory_spread_slab Michal Koutný
2025-03-11 15:07   ` Waiman Long
2025-03-11 12:36 ` [PATCH v2 03/11] cgroup/blkio: Add deprecation messages to reset_stats Michal Koutný
2025-03-11 12:36 ` [PATCH v2 04/11] cgroup: Print message when /proc/cgroups is read on v2-only system Michal Koutný
2025-03-11 12:36 ` [PATCH v2 05/11] cgroup/cpuset-v1: Add deprecation messages to mem_exclusive and mem_hardwall Michal Koutný
2025-03-11 15:08   ` Waiman Long
2025-03-11 12:36 ` [PATCH v2 06/11] cgroup/cpuset-v1: Add deprecation messages to memory_migrate Michal Koutný
2025-03-11 15:09   ` Waiman Long
2025-03-11 12:36 ` [PATCH v2 07/11] RFC cgroup/cpuset-v1: Add deprecation messages to sched_relax_domain_level Michal Koutný
2025-03-11 15:10   ` Waiman Long
2025-03-11 15:10   ` Waiman Long
2025-03-11 12:36 ` Michal Koutný [this message]
2025-03-11 12:36 ` [PATCH v2 09/11] cgroup: Add deprecation message to legacy freezer controller Michal Koutný
2025-03-11 12:36 ` [PATCH v2 10/11] cgroup: Update file naming comment Michal Koutný
2025-03-11 12:36 ` [PATCH v2 11/11] blk-cgroup: Simplify policy files registration Michal Koutný
2025-03-11 18:56 ` [PATCH v2 00/11] cgroup v1 deprecation messages Jens Axboe
2025-03-11 19:23 ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250311123640.530377-9-mkoutny@suse.com \
    --to=mkoutny@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=hannes@cmpxchg.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox