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 Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux