Skip to content

Commit

Permalink
mm: correctly charge compressed memory to its memcg
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Li Liguang authored and akpm00 committed Nov 23, 2022
1 parent b630504 commit cd08d80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit cd08d80

Please sign in to comment.