[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20221114194828.100822-1-hannes@cmpxchg.org>
Date: Mon, 14 Nov 2022 14:48:28 -0500
From: Johannes Weiner <hannes@...xchg.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org, Li Liguang <liliguang@...du.com>,
stable@...r.kernel.org, Shakeel Butt <shakeelb@...gle.com>,
Muchun Song <songmuchun@...edance.com>
Subject: [PATCH] mm: correctly charge compressed memory to its memcg
From: Li Liguang <liliguang@...du.com>
Kswapd will reclaim memory when memory pressure is high, the
annonymous memory will be compressed and stored in the zpool
if zswap is enabled. The memcg_kmem_bypass() in
get_obj_cgroup_from_page() will bypass the kernel thread and
cause the compressed memory not charged to its memory cgroup.
Remove the memcg_kmem_bypass() and properly charge compressed
memory to its corresponding memory cgroup.
Link: https://lore.kernel.org/linux-mm/CALvZod4nnn8BHYqAM4xtcR0Ddo2-Wr8uKm9h_CHWUaXw7g_DCg@mail.gmail.com/
Fixes: f4840ccfca25 ("zswap: memcg accounting")
Cc: stable@...r.kernel.org # 5.19+
Acked-by: Shakeel Butt <shakeelb@...gle.com>
Acked-by: Shakeel Butt <shakeelb@...gle.com>
Reviewed-by: Muchun Song <songmuchun@...edance.com>
Signed-off-by: Li Liguang <liliguang@...du.com>
Signed-off-by: Johannes Weiner <hannes@...xchg.org>
---
mm/memcontrol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
This fell through the cracks in summer as it didn't make it to the
right mailing lists. Resending.
I know it's close to 6.1-final, but the fix should be safe to put
in. It's straight-forward and obvious code-wise. We also have large
parts of production running on it without problems.
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 2d8549ae1b30..a1a35c12635e 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3026,7 +3026,7 @@ struct obj_cgroup *get_obj_cgroup_from_page(struct page *page)
{
struct obj_cgroup *objcg;
- if (!memcg_kmem_enabled() || memcg_kmem_bypass())
+ if (!memcg_kmem_enabled())
return NULL;
if (PageMemcgKmem(page)) {
--
2.38.1
Powered by blists - more mailing lists