Re: [REGRESSION] Re: [PATCH 6.1 033/219] memcg: drop kmem.limit_in_bytes

From: Michal Hocko
Date: Thu Sep 21 2023 - 16:28:28 EST


On Thu 21-09-23 10:25:11, Shakeel Butt wrote:
> On Thu, Sep 21, 2023 at 4:21 AM Michal Hocko <mhocko@xxxxxxxx> wrote:
[...]
> With one request below:
>
> Acked-by: Shakeel Butt <shakeelb@xxxxxxxxxx>

Thanks.

> > @@ -3107,6 +3108,10 @@ static int obj_cgroup_charge_pages(struct obj_cgroup *objcg, gfp_t gfp,
> > goto out;
> >
> > memcg_account_kmem(memcg, nr_pages);
> > +
> > + /* There is no way to set up kmem hard limit so this operation cannot fail */
> > + if (!cgroup_subsys_on_dfl(memory_cgrp_subsys))
> > + WARN_ON(!page_counter_try_charge(&memcg->kmem, nr_pages, &counter));
>
> WARN_ON_ONCE() please.

Sure. This shouldn't really trigger, but it is true that if something
unexpected happens then it is likly to flood the log so _ONCE is safer.

I will wait for others to comment before I send the official patch.
To be completely honest I am not super happy about this way of handling
stuff, but considering the level of brokenness this seems like the
safest option. Especially when nobody really want to use the kernel
memory hard limit AFAIU.
--
Michal Hocko
SUSE Labs