Re: [PATCH] mm: correctly charge compressed memory to its memcg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



+Andrew & linux-mm

On Thu, Aug 11, 2022 at 5:12 PM Roman Gushchin <roman.gushchin@xxxxxxxxx> wrote:
>
> On Thu, Aug 11, 2022 at 04:19:13PM +0800, liliguang wrote:
> > From: Li Liguang <liliguang@xxxxxxxxx>
> >
> > 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.
> >
> > Signed-off-by: Li Liguang <liliguang@xxxxxxxxx>
> > ---
> >  mm/memcontrol.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index b69979c9ced5..6a95ea7c5ee7 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -2971,7 +2971,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.32.0 (Apple Git-132)
> >
>
> Hi Li!
>
> The fix looks good to me! As we get objcg pointer from a page and not from
> the current task, memcg_kmem_bypass() doesn't makes much sense.
>
> Acked-by: Roman Gushchin <roman.gushchin@xxxxxxxxx>
>
> Probably, we need to add
> Fixes: f4840ccfca25 ("zswap: memcg accounting")
>
> Thank you!

You can add:

Acked-by: Shakeel Butt <shakeelb@xxxxxxxxxx>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux