From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,shikemeng@huaweicloud.com,shakeel.butt@linux.dev,roman.gushchin@linux.dev,nphamcs@gmail.com,muchun.song@linux.dev,mhocko@kernel.org,kasong@tencent.com,hannes@cmpxchg.org,chrisl@kernel.org,baoquan.he@linux.dev,baohua@kernel.org,chenridong@xiaomi.com,akpm@linux-foundation.org
Subject: [to-be-updated] memcg-move-mem_cgroup_swappiness-to-memcontrolh.patch removed from -mm tree
Date: Tue, 14 Jul 2026 19:32:45 -0700 [thread overview]
Message-ID: <20260715023245.E90711F00A3A@smtp.kernel.org> (raw)
The quilt patch titled
Subject: memcg: move mem_cgroup_swappiness to memcontrol.h
has been removed from the -mm tree. Its filename was
memcg-move-mem_cgroup_swappiness-to-memcontrolh.patch
This patch was dropped because an updated version will be issued
------------------------------------------------------
From: Ridong Chen <chenridong@xiaomi.com>
Subject: memcg: move mem_cgroup_swappiness to memcontrol.h
Date: Fri, 10 Jul 2026 19:12:24 +0800
The per-memcg swappiness knob is v1-only; v2 always uses global
vm_swappiness and ignores the per-cgroup field.
Guard memcg->swappiness with CONFIG_MEMCG_V1, and move the helper to
memcontrol.h where it belongs.
No functional change for v1; v2-only kernels drop the unused field.
Link: https://lore.kernel.org/20260710111224.2355668-1-ridong.chen@linux.dev
Signed-off-by: Ridong Chen <chenridong@xiaomi.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Baoquan He <baoquan.he@linux.dev>
Cc: Barry Song <baohua@kernel.org>
Cc: Chris Li <chrisl@kernel.org>
Cc: Kairui Song <kasong@tencent.com>
Cc: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/memcontrol.h | 25 +++++++++++++++++++++++--
include/linux/swap.h | 19 -------------------
mm/memcontrol.c | 3 +--
3 files changed, 24 insertions(+), 23 deletions(-)
--- a/include/linux/memcontrol.h~memcg-move-mem_cgroup_swappiness-to-memcontrolh
+++ a/include/linux/memcontrol.h
@@ -239,8 +239,6 @@ struct mem_cgroup {
*/
bool oom_group;
- int swappiness;
-
/* memory.events and memory.events.local */
struct cgroup_file events_file;
struct cgroup_file events_local_file;
@@ -318,6 +316,9 @@ struct mem_cgroup {
/* List of events which userspace want to receive */
struct list_head event_list;
spinlock_t event_list_lock;
+
+ int swappiness;
+
#endif /* CONFIG_MEMCG_V1 */
struct mem_cgroup_per_node *nodeinfo[];
@@ -365,6 +366,9 @@ enum objext_flags {
#define OBJEXTS_FLAGS_MASK (__NR_OBJEXTS_FLAGS - 1)
+/* Defined in mm/vmscan.c; used by mem_cgroup_swappiness(). */
+extern int vm_swappiness;
+
#ifdef CONFIG_MEMCG
/*
* After the initialization objcg->memcg is always pointing at
@@ -1440,6 +1444,23 @@ static inline void mem_cgroup_flush_work
static inline int mem_cgroup_init(void) { return 0; }
#endif /* CONFIG_MEMCG */
+static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg)
+{
+#ifdef CONFIG_MEMCG_V1
+ /* Cgroup2 doesn't have per-cgroup swappiness */
+ if (cgroup_subsys_on_dfl(memory_cgrp_subsys))
+ return READ_ONCE(vm_swappiness);
+
+ /* root ? */
+ if (mem_cgroup_disabled() || mem_cgroup_is_root(memcg))
+ return READ_ONCE(vm_swappiness);
+
+ return READ_ONCE(memcg->swappiness);
+#else
+ return READ_ONCE(vm_swappiness);
+#endif
+}
+
/*
* Extended information for slab objects stored as an array in page->memcg_data
* if MEMCG_DATA_OBJEXTS is set.
--- a/include/linux/swap.h~memcg-move-mem_cgroup_swappiness-to-memcontrolh
+++ a/include/linux/swap.h
@@ -309,7 +309,6 @@ static inline bool lru_cache_disabled(vo
}
extern unsigned long shrink_all_memory(unsigned long nr_pages);
-extern int vm_swappiness;
long remove_mapping(struct address_space *mapping, struct folio *folio);
#if defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
@@ -468,25 +467,7 @@ static inline int add_swap_extent(struct
}
#endif /* CONFIG_SWAP */
#ifdef CONFIG_MEMCG
-static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg)
-{
- /* Cgroup2 doesn't have per-cgroup swappiness */
- if (cgroup_subsys_on_dfl(memory_cgrp_subsys))
- return READ_ONCE(vm_swappiness);
-
- /* root ? */
- if (mem_cgroup_disabled() || mem_cgroup_is_root(memcg))
- return READ_ONCE(vm_swappiness);
-
- return READ_ONCE(memcg->swappiness);
-}
-
void lru_reparent_memcg(struct mem_cgroup *memcg, struct mem_cgroup *parent, int nid);
-#else
-static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg)
-{
- return READ_ONCE(vm_swappiness);
-}
#endif
#if defined(CONFIG_SWAP) && defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP)
--- a/mm/memcontrol.c~memcg-move-mem_cgroup_swappiness-to-memcontrolh
+++ a/mm/memcontrol.c
@@ -4174,11 +4174,10 @@ mem_cgroup_css_alloc(struct cgroup_subsy
#endif
page_counter_set_high(&memcg->swap, PAGE_COUNTER_MAX);
if (parent) {
- WRITE_ONCE(memcg->swappiness, mem_cgroup_swappiness(parent));
-
page_counter_init(&memcg->memory, &parent->memory, memcg_on_dfl);
page_counter_init(&memcg->swap, &parent->swap, false);
#ifdef CONFIG_MEMCG_V1
+ WRITE_ONCE(memcg->swappiness, mem_cgroup_swappiness(parent));
memcg->memory.track_failcnt = !memcg_on_dfl;
WRITE_ONCE(memcg->oom_kill_disable, READ_ONCE(parent->oom_kill_disable));
page_counter_init(&memcg->kmem, &parent->kmem, false);
_
Patches currently in -mm which might be from chenridong@xiaomi.com are
reply other threads:[~2026-07-15 2:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260715023245.E90711F00A3A@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baoquan.he@linux.dev \
--cc=chenridong@xiaomi.com \
--cc=chrisl@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kasong@tencent.com \
--cc=mhocko@kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=muchun.song@linux.dev \
--cc=nphamcs@gmail.com \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=shikemeng@huaweicloud.com \
/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