Skip to content

Commit d5f0d56

Browse files
Li LiguangSasha Levin
Li Liguang
authored and
Sasha Levin
committed
mm: correctly charge compressed memory to its memcg
commit cd08d80 upstream. 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/[email protected] Fixes: f4840cc ("zswap: memcg accounting") Signed-off-by: Li Liguang <[email protected]> Signed-off-by: Johannes Weiner <[email protected]> Acked-by: Shakeel Butt <[email protected]> Reviewed-by: Muchun Song <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Roman Gushchin <[email protected]> Cc: <[email protected]> [5.19+] Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 54598bc commit d5f0d56

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/memcontrol.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2971,7 +2971,7 @@ struct obj_cgroup *get_obj_cgroup_from_page(struct page *page)
29712971
{
29722972
struct obj_cgroup *objcg;
29732973

2974-
if (!memcg_kmem_enabled() || memcg_kmem_bypass())
2974+
if (!memcg_kmem_enabled())
29752975
return NULL;
29762976

29772977
if (PageMemcgKmem(page)) {

0 commit comments

Comments
 (0)