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 22:28:33 +0800 [thread overview]
Message-ID: <CALOAHbBQMWkFX6U+yY7wsgmqjncj2kdgFg3Oqpr0meU20HOBJw@mail.gmail.com> (raw)
In-Reply-To: <20200406142530.GC21484@bombadil.infradead.org>
On Mon, Apr 6, 2020 at 10:25 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Mon, Apr 06, 2020 at 10:16:56PM +0800, Yafang Shao wrote:
> > On Mon, Apr 6, 2020 at 10:11 PM Matthew Wilcox <willy@infradead.org> wrote:
> > >
> > > On Mon, Apr 06, 2020 at 10:09:55PM +0800, Yafang Shao wrote:
> > > > What about ida_alloc_range() ? Should we correct it as well ?
> > > >
> > > >
> > > > * Return: The allocated ID, or %-ENOMEM if memory could not be allocated,
> > > > * or %-ENOSPC if there are no free IDs.
> > > > */
> > > > int ida_alloc_range(struct ida *ida, unsigned int min, unsigned int max,
> > > > gfp_t gfp)
> > > >
> > > > If there're no free IDs, ida_alloc_range() also returns ENOSPC.
> > >
> > > Do you want to check all the callers of ida_.*alloc()?
> >
> > Sorry, I can't your point.
>
> Changing the value returned by ida_alloc_range() would require checking
> every caller to see if it would break anything. That's why I didn't
> change it when I rewrote it.
>
Got it. Thanks for the explaination.
> > I just find the mem_cgroup_css_alloc() will use ida too.
> > mem_cgroup_css_alloc
> > memcg_online_kmem
> > memcg_alloc_cache_id
> > ida_simple_get
> >
> > I think we should keep the behavior consistent here.
>
> ENOSPC doesn't make much sense here. So I'd do:
>
> id = ida_simple_get(&memcg_cache_ida,
> 0, MEMCG_CACHES_MAX_SIZE, GFP_KERNEL);
> + if (id == -ENOSPC)
> + return -EBUSY;
> if (id < 0)
> return id;
>
Understood!
Thanks
Yafang
prev parent reply other threads:[~2020-04-06 14:29 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
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 [this message]
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=CALOAHbBQMWkFX6U+yY7wsgmqjncj2kdgFg3Oqpr0meU20HOBJw@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