linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Roman Gushchin <guro@fb.com>
To: Waiman Long <longman@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@kernel.org>,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>, <linux-kernel@vger.kernel.org>,
	<cgroups@vger.kernel.org>, <linux-mm@kvack.org>,
	Shakeel Butt <shakeelb@google.com>,
	Muchun Song <songmuchun@bytedance.com>
Subject: Re: [PATCH 2/3] mm, memcg: Remove obsolete memcg_free_kmem()
Date: Fri, 1 Oct 2021 17:01:03 -0700	[thread overview]
Message-ID: <YVehP18mCcsXmFy1@carbon.dhcp.thefacebook.com> (raw)
In-Reply-To: <20211001190938.14050-3-longman@redhat.com>

On Fri, Oct 01, 2021 at 03:09:37PM -0400, Waiman Long wrote:
> Since commit d648bcc7fe65 ("mm: kmem: make memcg_kmem_enabled()
> irreversible"), the only thing memcg_free_kmem() does is to call
> memcg_offline_kmem() when the memcg is still online. However,
> memcg_offline_kmem() is only called from mem_cgroup_css_free() which
> cannot be reached if the memcg hasn't been offlined first.

Hm, is it true? What if online_css() fails?

> As this
> function now serves no purpose, we should just remove it.

It looks like we can just use memcg_offline_kmem() instead of
memcg_free_kmem().

Thanks!

> 
> Signed-off-by: Waiman Long <longman@redhat.com>
> ---
>  mm/memcontrol.c | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 4568363062c1..8177f253a127 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3673,13 +3673,6 @@ static void memcg_offline_kmem(struct mem_cgroup *memcg)
>  
>  	memcg_free_cache_id(kmemcg_id);
>  }
> -
> -static void memcg_free_kmem(struct mem_cgroup *memcg)
> -{
> -	/* css_alloc() failed, offlining didn't happen */
> -	if (unlikely(memcg->kmem_state == KMEM_ONLINE))
> -		memcg_offline_kmem(memcg);
> -}
>  #else
>  static int memcg_online_kmem(struct mem_cgroup *memcg)
>  {
> @@ -3688,9 +3681,6 @@ static int memcg_online_kmem(struct mem_cgroup *memcg)
>  static void memcg_offline_kmem(struct mem_cgroup *memcg)
>  {
>  }
> -static void memcg_free_kmem(struct mem_cgroup *memcg)
> -{
> -}
>  #endif /* CONFIG_MEMCG_KMEM */
>  
>  static int memcg_update_kmem_max(struct mem_cgroup *memcg,
> @@ -5325,7 +5315,6 @@ static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
>  	cancel_work_sync(&memcg->high_work);
>  	mem_cgroup_remove_from_trees(memcg);
>  	free_shrinker_info(memcg);
> -	memcg_free_kmem(memcg);
>  	mem_cgroup_free(memcg);
>  }
>  
> -- 
> 2.18.1
> 


  reply	other threads:[~2021-10-02  0:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 19:09 [PATCH 0/3] mm, memcg: Miscellaneous cleanups Waiman Long
2021-10-01 19:09 ` [PATCH 1/3] mm, memcg: Don't put offlined memcg into local stock Waiman Long
2021-10-01 21:17   ` kernel test robot
2021-10-01 23:06   ` kernel test robot
2021-10-01 23:51   ` Roman Gushchin
2021-10-02  1:54     ` Waiman Long
2022-01-31  3:55     ` Waiman Long
2022-01-31 17:01       ` Roman Gushchin
2022-01-31 17:09         ` Waiman Long
2022-01-31 17:15           ` Waiman Long
2022-01-31 17:19             ` Roman Gushchin
2022-01-31 17:25               ` Waiman Long
2022-01-31 18:00                 ` Shakeel Butt
2022-01-31 17:15           ` Roman Gushchin
2021-10-01 19:09 ` [PATCH 2/3] mm, memcg: Remove obsolete memcg_free_kmem() Waiman Long
2021-10-02  0:01   ` Roman Gushchin [this message]
2021-10-02  2:03     ` Waiman Long
2021-10-01 19:09 ` [PATCH 3/3] mm, memcg: Ensure valid memcg from objcg within a RCU critical section Waiman Long
2021-10-01 20:24   ` Shakeel Butt
2021-10-01 20:34     ` Waiman Long

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YVehP18mCcsXmFy1@carbon.dhcp.thefacebook.com \
    --to=guro@fb.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=longman@redhat.com \
    --cc=mhocko@kernel.org \
    --cc=shakeelb@google.com \
    --cc=songmuchun@bytedance.com \
    --cc=vbabka@suse.cz \
    --cc=vdavydov.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox