From: Roman Gushchin <guro-b10kYP2dOMg@public.gmane.org>
To: Waiman Long <longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
Michal Hocko <mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Vladimir Davydov
<vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
Vlastimil Babka <vbabka-AlSwsSmVLrQ@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
Shakeel Butt <shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Muchun Song <songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
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-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
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-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> 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
>
next prev parent 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
[not found] ` <20211001190938.14050-1-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2021-10-01 19:09 ` [PATCH 1/3] mm, memcg: Don't put offlined memcg into local stock Waiman Long
[not found] ` <20211001190938.14050-2-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2021-10-01 21:17 ` kernel test robot
2021-10-01 23:06 ` kernel test robot
2021-10-01 23:51 ` Roman Gushchin
[not found] ` <YVefHLo1+6lgw3aB-cx5fftMpWqeCjSd+JxjunQ2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
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
[not found] ` <c950a93d-bb70-9a97-dabe-a1d58d755dad-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-01-31 17:19 ` Roman Gushchin
[not found] ` <YfgaIcSJhqEOnh65-cx5fftMpWqeCjSd+JxjunQ2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2022-01-31 17:25 ` Waiman Long
[not found] ` <9abc9cb8-8734-90b0-c495-8df89c7bb579-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-01-31 18:00 ` Shakeel Butt
[not found] ` <95ba1931-e9c9-45c3-b080-d28f2ad368a7-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-01-31 17:15 ` Roman Gushchin
2021-10-01 19:09 ` [PATCH 2/3] mm, memcg: Remove obsolete memcg_free_kmem() Waiman Long
[not found] ` <20211001190938.14050-3-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
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
[not found] ` <20211001190938.14050-4-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
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-b10kyp2domg@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
--cc=longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org \
--cc=vbabka-AlSwsSmVLrQ@public.gmane.org \
--cc=vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/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