From: Yafang Shao <laoar.shao@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Vladimir Davydov <vdavydov.dev@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linux MM <linux-mm@kvack.org>
Subject: Re: [PATCH] mm, memcg: fix error return value of mem_cgroup_alloc()
Date: Mon, 6 Apr 2020 21:30:47 +0800 [thread overview]
Message-ID: <CALOAHbBkhGm=q+5iuEhCrWWY9=D+MNdZNvQK51G3Xj-eet=MOA@mail.gmail.com> (raw)
In-Reply-To: <20200406130533.GZ21484@bombadil.infradead.org>
On Mon, Apr 6, 2020 at 9:05 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Mon, Apr 06, 2020 at 08:54:07AM -0400, Yafang Shao wrote:
> > When I run my memcg testcase which creates lots of memcgs, I found
> > there're unexpected out of memory logs while there're still enough
> > available free memory. The error log is,
> > mkdir: cannot create directory 'foo.65533': Cannot allocate memory
> >
> > The reason is when we try to create more than MEM_CGROUP_ID_MAX memcgs, an
> > -ENOMEM errno will be set by mem_cgroup_css_alloc(), but the right errno
> > should be -ENOSPC, as explained above the function idr_alloc().
>
> I think idr_alloc() is wrong. I think the right errno to return here is
> EBUSY "Device or resource busy".
>
Agree with you that EBUSY is better.
I will correct it.
> > -static struct mem_cgroup *mem_cgroup_alloc(void)
> > +static struct mem_cgroup *mem_cgroup_alloc(long *error)
>
> The normal way to do this is to return an ERR_PTR(). See
> include/linux/err.h.
>
Thanks for your advise. I will take a look at it.
Thanks
Yafang
next prev parent reply other threads:[~2020-04-06 13:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-06 12:54 Yafang Shao
2020-04-06 13:05 ` Matthew Wilcox
2020-04-06 13:30 ` Yafang Shao [this message]
2020-04-06 14:09 ` Yafang Shao
2020-04-06 14:11 ` Matthew Wilcox
2020-04-06 14:16 ` Yafang Shao
2020-04-06 14:25 ` Matthew Wilcox
2020-04-06 14:28 ` Yafang Shao
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='CALOAHbBkhGm=q+5iuEhCrWWY9=D+MNdZNvQK51G3Xj-eet=MOA@mail.gmail.com' \
--to=laoar.shao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=vdavydov.dev@gmail.com \
--cc=willy@infradead.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