[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221215091907.763801-1-haifeng.xu@shopee.com>
Date: Thu, 15 Dec 2022 09:19:07 +0000
From: Haifeng Xu <haifeng.xu@...pee.com>
To: akpm@...ux-foundation.org
Cc: shakeelb@...gle.com, roman.gushchin@...ux.dev,
songmuchun@...edance.com, hannes@...xchg.org, vbabka@...e.cz,
willy@...radead.org, vasily.averin@...ux.dev,
linux-kernel@...r.kernel.org, Haifeng Xu <haifeng.xu@...pee.com>
Subject: [PATCH] mm/memcontrol: Skip root memcg in memcg_memory_event_mm
The memory events aren't supported on root cgroup, so there is no need
to account MEMCG_OOM_KILL on root memcg.
Signed-off-by: Haifeng Xu <haifeng.xu@...pee.com>
---
include/linux/memcontrol.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 567f12323f55..09f75161a3bc 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -1142,7 +1142,7 @@ static inline void memcg_memory_event_mm(struct mm_struct *mm,
rcu_read_lock();
memcg = mem_cgroup_from_task(rcu_dereference(mm->owner));
- if (likely(memcg))
+ if (likely(memcg && !mem_cgroup_is_root(memcg)))
memcg_memory_event(memcg, event);
rcu_read_unlock();
}
--
2.25.1
Powered by blists - more mailing lists