All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,tj@kernel.org,shuah@kernel.org,shakeel.butt@linux.dev,roman.gushchin@linux.dev,muchun.song@linux.dev,mkoutny@suse.com,mhocko@kernel.org,hannes@cmpxchg.org,longman@redhat.com,akpm@linux-foundation.org
Subject: + mm-vmscan-skip-memcg-with-usage-in-shrink_node_memcgs-v5.patch added to mm-new branch
Date: Mon, 07 Apr 2025 11:31:26 -0700	[thread overview]
Message-ID: <20250407183127.4D4BEC4CEDD@smtp.kernel.org> (raw)

[-- 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


                 reply	other threads:[~2025-04-07 18:31 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=20250407183127.4D4BEC4CEDD@smtp.kernel.org \
    --to=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=longman@redhat.com \
    --cc=mhocko@kernel.org \
    --cc=mkoutny@suse.com \
    --cc=mm-commits@vger.kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=shuah@kernel.org \
    --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 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.