Skip to content

Commit ec9996a

Browse files
Li Liguanggregkh
authored andcommitted
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 c7226c8 commit ec9996a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/memcontrol.c

Lines changed: 1 addition & 1 deletion
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)