]> git.baikalelectronics.ru Git - kernel.git/commit
mm: correctly charge compressed memory to its memcg
authorLi Liguang <liliguang@baidu.com>
Mon, 14 Nov 2022 19:48:28 +0000 (14:48 -0500)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 23 Nov 2022 02:50:42 +0000 (18:50 -0800)
commitba85131d78790220d93dbb823267dc1c45e020cf
tree9739aa19a573c79c1b5a9422d6cc9f78ca5052ab
parent9090f67616fdddaa3ba0fa82f69d229946e6a145
mm: correctly charge compressed memory to its memcg

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 be charged to its memory
cgroup.

Remove the memcg_kmem_bypass() call and properly charge compressed memory
to its corresponding memory cgroup.

Link: https://lore.kernel.org/linux-mm/CALvZod4nnn8BHYqAM4xtcR0Ddo2-Wr8uKm9h_CHWUaXw7g_DCg@mail.gmail.com/
Link: https://lkml.kernel.org/r/20221114194828.100822-1-hannes@cmpxchg.org
Fixes: ded3df4283a9 ("zswap: memcg accounting")
Signed-off-by: Li Liguang <liliguang@baidu.com>
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Shakeel Butt <shakeelb@google.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: <stable@vger.kernel.org> [5.19+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memcontrol.c