Re: High kmalloc-32 slab cache consumption with 10k containers

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

 



On Mon, Apr 05, 2021 at 11:38:44AM -0700, Roman Gushchin wrote:
> > > @@ -534,7 +521,17 @@ static void memcg_drain_list_lru_node(struct list_lru *lru, int nid,
> > >         spin_lock_irq(&nlru->lock);
> > >
> > >         src = list_lru_from_memcg_idx(nlru, src_idx);
> > > +       if (!src)
> > > +               goto out;
> > > +
> > >         dst = list_lru_from_memcg_idx(nlru, dst_idx);
> > > +       if (!dst) {
> > > +               /* TODO: Use __GFP_NOFAIL? */
> > > +               dst = kmalloc(sizeof(struct list_lru_one), GFP_ATOMIC);
> > > +               init_one_lru(dst);
> > > +               memcg_lrus = rcu_dereference_protected(nlru->memcg_lrus, true);
> > > +               memcg_lrus->lru[dst_idx] = dst;
> > > +       }
> 
> Hm, can't we just reuse src as dst in this case?
> We don't need src anymore and we're basically allocating dst to move all data from src.

Yes, we can do that and it would be much simpler.

> If not, we can allocate up to the root memcg every time to avoid having
> !dst case and fiddle with __GFP_NOFAIL.
> 
> Otherwise I like the idea and I think it might reduce the memory overhead
> especially on (very) big machines.

Yes, I will however have to check if the callers of list_lru_add() are capable
of handling failure which can happen with this approach if kmalloc fails.

Regards,
Bharata.




[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