linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/memcg: Skip high limit check in root memcg
@ 2023-02-10  9:45 Haifeng Xu
  2023-02-14 15:56 ` Michal Hocko
  0 siblings, 1 reply; 6+ messages in thread
From: Haifeng Xu @ 2023-02-10  9:45 UTC (permalink / raw)
  To: hannes
  Cc: mhocko, shakeelb, muchun.song, akpm, cgroups, linux-mm,
	linux-kernel, Haifeng Xu

The high limit checks the memory usage from given memcg to root memcg.
However, there is no limit in root memcg. So this check makes no sense
and we can ignore it.

Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
---
 mm/memcontrol.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 73afff8062f9..a31a56598f29 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2780,6 +2780,10 @@ static int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
 	do {
 		bool mem_high, swap_high;
 
+		/* There is no need for root memcg to check high limit */
+		if (mem_cgroup_is_root(memcg))
+			break;
+
 		mem_high = page_counter_read(&memcg->memory) >
 			READ_ONCE(memcg->memory.high);
 		swap_high = page_counter_read(&memcg->swap) >
-- 
2.25.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-02-21 15:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-10  9:45 [PATCH] mm/memcg: Skip high limit check in root memcg Haifeng Xu
2023-02-14 15:56 ` Michal Hocko
2023-02-21 10:29   ` Haifeng Xu
2023-02-21 12:20     ` Michal Hocko
2023-02-21 14:21       ` Haifeng Xu
2023-02-21 15:21         ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox