* + mm-vmscan-skip-memcg-with-usage-in-shrink_node_memcgs-v5.patch added to mm-new branch
@ 2025-04-07 18:31 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-04-07 18:31 UTC (permalink / raw)
To: mm-commits, tj, shuah, shakeel.butt, roman.gushchin, muchun.song,
mkoutny, mhocko, hannes, longman, akpm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4287 bytes --]
The patch titled
Subject: mm/vmscan: Skip memcg with !usage in shrink_node_memcgs()
has been added to the -mm mm-new branch. Its filename is
mm-vmscan-skip-memcg-with-usage-in-shrink_node_memcgs-v5.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-vmscan-skip-memcg-with-usage-in-shrink_node_memcgs-v5.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Waiman Long <longman@redhat.com>
Subject: mm/vmscan: Skip memcg with !usage in shrink_node_memcgs()
Date: Mon, 7 Apr 2025 12:23:15 -0400
use mem_cgroup_usage() as originally suggested by Johannes
Link: https://lkml.kernel.org/r/20250407162316.1434714-2-longman@redhat.com
Signed-off-by: Waiman Long <longman@redhat.com>
Suggested-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Michal Koutný <mkoutny@suse.com>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/internal.h | 9 +++++++++
mm/memcontrol-v1.h | 2 --
mm/vmscan.c | 8 +-------
3 files changed, 10 insertions(+), 9 deletions(-)
--- a/mm/internal.h~mm-vmscan-skip-memcg-with-usage-in-shrink_node_memcgs-v5
+++ a/mm/internal.h
@@ -1538,6 +1538,15 @@ void __meminit __init_page_from_nid(unsi
unsigned long shrink_slab(gfp_t gfp_mask, int nid, struct mem_cgroup *memcg,
int priority);
+#ifdef CONFIG_MEMCG
+unsigned long mem_cgroup_usage(struct mem_cgroup *memcg, bool swap);
+#else
+static inline unsigned long mem_cgroup_usage(struct mem_cgroup *memcg, bool swap)
+{
+ return 1UL;
+}
+#endif
+
#ifdef CONFIG_SHRINKER_DEBUG
static inline __printf(2, 0) int shrinker_debugfs_name_alloc(
struct shrinker *shrinker, const char *fmt, va_list ap)
--- a/mm/memcontrol-v1.h~mm-vmscan-skip-memcg-with-usage-in-shrink_node_memcgs-v5
+++ a/mm/memcontrol-v1.h
@@ -22,8 +22,6 @@
iter != NULL; \
iter = mem_cgroup_iter(NULL, iter, NULL))
-unsigned long mem_cgroup_usage(struct mem_cgroup *memcg, bool swap);
-
void drain_all_stock(struct mem_cgroup *root_memcg);
unsigned long memcg_events(struct mem_cgroup *memcg, int event);
--- a/mm/vmscan.c~mm-vmscan-skip-memcg-with-usage-in-shrink_node_memcgs-v5
+++ a/mm/vmscan.c
@@ -5934,7 +5934,6 @@ static inline bool should_continue_recla
return inactive_lru_pages > pages_for_compaction;
}
-#ifdef CONFIG_MEMCG
static void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc)
{
struct mem_cgroup *target_memcg = sc->target_mem_cgroup;
@@ -5973,7 +5972,7 @@ static void shrink_node_memcgs(pg_data_t
mem_cgroup_calculate_protection(target_memcg, memcg);
/* Skip memcg with no usage */
- if (!page_counter_read(&memcg->memory))
+ if (!mem_cgroup_usage(memcg, false))
continue;
if (mem_cgroup_below_min(target_memcg, memcg)) {
@@ -6017,11 +6016,6 @@ static void shrink_node_memcgs(pg_data_t
}
} while ((memcg = mem_cgroup_iter(target_memcg, memcg, partial)));
}
-#else
-static inline void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc)
-{
-}
-#endif /* CONFIG_MEMCG */
static void shrink_node(pg_data_t *pgdat, struct scan_control *sc)
{
_
Patches currently in -mm which might be from longman@redhat.com are
mm-vmscan-skip-memcg-with-usage-in-shrink_node_memcgs.patch
mm-vmscan-skip-memcg-with-usage-in-shrink_node_memcgs-v5.patch
selftests-memcg-increase-error-tolerance-of-child-memorycurrent-check-in-test_memcg_protection.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-04-07 18:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07 18:31 + mm-vmscan-skip-memcg-with-usage-in-shrink_node_memcgs-v5.patch added to mm-new branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.