From c72c438f55508ce4df189b7a8d197d74d8b28a55 Mon Sep 17 00:00:00 2001 From: CY Fan Date: Tue, 17 May 2022 15:12:56 +0800 Subject: [PATCH] kswapd: fix kswapd failing to reclaim slab and anon ohos inclusion category: bugfix issue: #I57QRB CVE: NA -------------------------------- Commit fa523f8bb46f ("memcg: fix memcg use case timeout issue") avoids unnecessary scans by excluding non-target memcg. However, for kswapd, target memcg is null and will be skipped, so kswapd cannot reclaim slab and anon normally. Therefore, a non-null judgement is added to avoid this situation. Signed-off-by: CY Fan --- mm/memcg_reclaim.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/memcg_reclaim.c b/mm/memcg_reclaim.c index 74c3d4dfa08b..9f879a385b4d 100644 --- a/mm/memcg_reclaim.c +++ b/mm/memcg_reclaim.c @@ -217,6 +217,9 @@ void shrink_anon_memcg(struct pglist_data *pgdat, static inline bool memcg_is_child_of(struct mem_cgroup *mcg, struct mem_cgroup *tmcg) { + if (tmcg == NULL) + return true; + while (!mem_cgroup_is_root(mcg)) { if (mcg == tmcg) break; -- Gitee