Re: [PATCH v2] mm, memcg: fix error return value of mem_cgroup_css_alloc()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 7, 2020 at 12:42 AM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> On Mon, Apr 06, 2020 at 11:48:54PM +0800, Yafang Shao wrote:
> > @@ -2717,8 +2717,12 @@ static int memcg_alloc_cache_id(void)
> >
> >       id = ida_simple_get(&memcg_cache_ida,
> >                           0, MEMCG_CACHES_MAX_SIZE, GFP_KERNEL);
> > -     if (id < 0)
> > +     if (id < 0) {
> > +             if (id == -ENOSPC)
> > +                     id = -EBUSY;
> > +
> >               return id;
> > +     }
>
> This seems more complex than my original suggestion?
>

I thought the (id < 0) is an unlikely case, writing it like this only
checks id once for the most common case, while your original
suggestion will check id twice if the compiler is not good enough.
But that is not a big problem, I can change it as you suggestion. Your
suggestion is more readable.


Thanks
Yafang




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux