From: Johannes Weiner <hannes@cmpxchg.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org, Li Liguang <liliguang@baidu.com>,
stable@vger.kernel.org, Shakeel Butt <shakeelb@google.com>,
Muchun Song <songmuchun@bytedance.com>
Subject: [PATCH] mm: correctly charge compressed memory to its memcg
Date: Mon, 14 Nov 2022 14:48:28 -0500 [thread overview]
Message-ID: <20221114194828.100822-1-hannes@cmpxchg.org> (raw)
From: Li Liguang <liliguang@baidu.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@vger.kernel.org # 5.19+
Acked-by: Shakeel Butt <shakeelb@google.com>
Acked-by: Shakeel Butt <shakeelb@google.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Li Liguang <liliguang@baidu.com>
Signed-off-by: Johannes Weiner <hannes@cmpxchg.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
next reply other threads:[~2022-11-14 19:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-14 19:48 Johannes Weiner [this message]
[not found] <20220811081913.102770-1-liliguang@baidu.com>
[not found] ` <YvWa9MOQWBICInjO@P9FQF9L96D.corp.robot.car>
2022-08-12 21:56 ` Shakeel Butt
2022-08-13 0:43 ` Yosry Ahmed
2022-08-15 2:52 ` Li,Liguang
2022-08-15 8:09 ` Yosry Ahmed
2022-08-15 11:48 ` Li,Liguang
2022-08-15 13:46 ` Yosry Ahmed
2022-08-15 15:31 ` Johannes Weiner
2022-08-15 15:42 ` Yosry Ahmed
2022-08-15 16:16 ` Yosry Ahmed
2022-08-15 17:47 ` Johannes Weiner
2022-08-15 17:55 ` Yosry Ahmed
2022-08-16 22:19 ` Shakeel Butt
2022-08-15 6:52 ` Muchun Song
2022-08-15 15:20 ` Johannes Weiner
2022-08-17 17:17 ` Andrew Morton
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=20221114194828.100822-1-hannes@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=liliguang@baidu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shakeelb@google.com \
--cc=songmuchun@bytedance.com \
--cc=stable@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox