From: Roman Gushchin <guro@fb.com>
To: Muchun Song <songmuchun@bytedance.com>
Cc: <hannes@cmpxchg.org>, <mhocko@kernel.org>,
<vdavydov.dev@gmail.com>, <akpm@linux-foundation.org>,
<cai@lca.pw>, <cgroups@vger.kernel.org>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: memcontrol: Fix do not put the css reference
Date: Sun, 14 Jun 2020 10:22:38 -0700 [thread overview]
Message-ID: <20200614172238.GA755479@carbon.DHCP.thefacebook.com> (raw)
In-Reply-To: <20200614122653.98829-1-songmuchun@bytedance.com>
On Sun, Jun 14, 2020 at 08:26:53PM +0800, Muchun Song wrote:
> We should put the css reference when memory allocation failed.
>
> Fixes: f0a3a24b532d ("mm: memcg/slab: rework non-root kmem_cache lifecycle management")
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> ---
> mm/memcontrol.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Good catch, thank you!
Acked-by: Roman Gushchin <guro@fb.com>
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 0b38b6ad547d..2323d811ee8e 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2772,8 +2772,10 @@ static void memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg,
> return;
>
> cw = kmalloc(sizeof(*cw), GFP_NOWAIT | __GFP_NOWARN);
> - if (!cw)
> + if (!cw) {
> + css_put(&memcg->css);
> return;
> + }
>
> cw->memcg = memcg;
> cw->cachep = cachep;
> --
> 2.11.0
>
next prev parent reply other threads:[~2020-06-14 17:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-14 12:26 Muchun Song
2020-06-14 17:22 ` Roman Gushchin [this message]
2020-06-15 11:50 ` Michal Hocko
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=20200614172238.GA755479@carbon.DHCP.thefacebook.com \
--to=guro@fb.com \
--cc=akpm@linux-foundation.org \
--cc=cai@lca.pw \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=songmuchun@bytedance.com \
--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