linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
  • * Re: [PATCH] mm: correctly charge compressed memory to its memcg
           [not found] <20220811081913.102770-1-liliguang@baidu.com>
           [not found] ` <YvWa9MOQWBICInjO@P9FQF9L96D.corp.robot.car>
    @ 2022-08-15  6:52 ` Muchun Song
      2022-08-15 15:20 ` Johannes Weiner
      2 siblings, 0 replies; 16+ messages in thread
    From: Muchun Song @ 2022-08-15  6:52 UTC (permalink / raw)
      To: liliguang
      Cc: Cgroups, Johannes Weiner, Michal Hocko, Roman Gushchin,
    	Shakeel Butt, Andrew Morton, Linux Memory Management List
    
    On Thu, Aug 11, 2022 at 4:19 PM liliguang <liliguang@baidu.com> wrote:
    >
    > From: Li Liguang <liliguang@baidu.com>
    >
    > 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@baidu.com>
    
    Reviewed-by: Muchun Song <songmuchun@bytedance.com>
    
    Thanks.
    
    
    ^ permalink raw reply	[flat|nested] 16+ messages in thread
  • * Re: [PATCH] mm: correctly charge compressed memory to its memcg
           [not found] <20220811081913.102770-1-liliguang@baidu.com>
           [not found] ` <YvWa9MOQWBICInjO@P9FQF9L96D.corp.robot.car>
      2022-08-15  6:52 ` Muchun Song
    @ 2022-08-15 15:20 ` Johannes Weiner
      2022-08-17 17:17   ` Andrew Morton
      2 siblings, 1 reply; 16+ messages in thread
    From: Johannes Weiner @ 2022-08-15 15:20 UTC (permalink / raw)
      To: liliguang
      Cc: cgroups, mhocko, roman.gushchin, shakeelb, songmuchun,
    	Andrew Morton, linux-mm
    
    On Thu, Aug 11, 2022 at 04:19:13PM +0800, liliguang wrote:
    > From: Li Liguang <liliguang@baidu.com>
    > 
    > 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@baidu.com>
    
    Great catch. I think this qualifies for stable.
    
    Cc: stable@vger.kernel.org # 5.19
    Fixes: f4840ccfca25 ("zswap: memcg accounting")
    Acked-by: Johannes Weiner <hannes@cmpxchg.org>
    
    Andrew, can you please take this through the MM tree?
    
    > ---
    >  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)
    > 
    
    
    ^ permalink raw reply	[flat|nested] 16+ messages in thread
  • * [PATCH] mm: correctly charge compressed memory to its memcg
    @ 2022-11-14 19:48 Johannes Weiner
      0 siblings, 0 replies; 16+ messages in thread
    From: Johannes Weiner @ 2022-11-14 19:48 UTC (permalink / raw)
      To: Andrew Morton
      Cc: linux-mm, cgroups, linux-kernel, Li Liguang, stable,
    	Shakeel Butt, Muchun Song
    
    From: Li Liguang <liliguang@baidu.com>
    
    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.
    
    Link: https://lore.kernel.org/linux-mm/CALvZod4nnn8BHYqAM4xtcR0Ddo2-Wr8uKm9h_CHWUaXw7g_DCg@mail.gmail.com/
    Fixes: f4840ccfca25 ("zswap: memcg accounting")
    Cc: stable@vger.kernel.org # 5.19+
    Acked-by: Shakeel Butt <shakeelb@google.com>
    Acked-by: Shakeel Butt <shakeelb@google.com>
    Reviewed-by: Muchun Song <songmuchun@bytedance.com>
    Signed-off-by: Li Liguang <liliguang@baidu.com>
    Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
    ---
     mm/memcontrol.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    This fell through the cracks in summer as it didn't make it to the
    right mailing lists. Resending.
    
    I know it's close to 6.1-final, but the fix should be safe to put
    in. It's straight-forward and obvious code-wise. We also have large
    parts of production running on it without problems.
    
    diff --git a/mm/memcontrol.c b/mm/memcontrol.c
    index 2d8549ae1b30..a1a35c12635e 100644
    --- a/mm/memcontrol.c
    +++ b/mm/memcontrol.c
    @@ -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)) {
    -- 
    2.38.1
    
    
    
    ^ permalink raw reply	[flat|nested] 16+ messages in thread

    end of thread, other threads:[~2022-11-14 19:48 UTC | newest]
    
    Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
    -- links below jump to the message on this page --
         [not found] <20220811081913.102770-1-liliguang@baidu.com>
         [not found] ` <YvWa9MOQWBICInjO@P9FQF9L96D.corp.robot.car>
    2022-08-12 21:56   ` [PATCH] mm: correctly charge compressed memory to its memcg Shakeel Butt
    2022-08-13  0:43     ` Yosry Ahmed
    2022-08-15  2:52       ` Li,Liguang
    2022-08-15  8:09         ` Yosry Ahmed
    2022-08-15 11:48           ` Li,Liguang
    2022-08-15 13:46             ` Yosry Ahmed
    2022-08-15 15:31               ` Johannes Weiner
    2022-08-15 15:42                 ` Yosry Ahmed
    2022-08-15 16:16                   ` Yosry Ahmed
    2022-08-15 17:47                     ` Johannes Weiner
    2022-08-15 17:55                       ` Yosry Ahmed
    2022-08-16 22:19                         ` Shakeel Butt
    2022-08-15  6:52 ` Muchun Song
    2022-08-15 15:20 ` Johannes Weiner
    2022-08-17 17:17   ` Andrew Morton
    2022-11-14 19:48 Johannes Weiner
    

    This is a public inbox, see mirroring instructions
    for how to clone and mirror all data and code used for this inbox