lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210406101331.GB1354243@in.ibm.com>
Date:   Tue, 6 Apr 2021 15:43:31 +0530
From:   Bharata B Rao <bharata@...ux.ibm.com>
To:     Roman Gushchin <guro@...com>
Cc:     Yang Shi <shy828301@...il.com>,
        Kirill Tkhai <ktkhai@...tuozzo.com>,
        Shakeel Butt <shakeelb@...gle.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux MM <linux-mm@...ck.org>,
        Linux FS-devel Mailing List <linux-fsdevel@...r.kernel.org>,
        aneesh.kumar@...ux.ibm.com
Subject: Re: High kmalloc-32 slab cache consumption with 10k containers

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ