linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Balbir Singh <bsingharora@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Vlastimil Babka <vbabka@suse.cz>,
	linux-mm@kvack.org, mhocko@kernel.org, hannes@cmpxchg.org,
	vdavydov.dev@gmail.com
Subject: Re: [PATCH] mm/list_lru: dont make them memcg aware if kmem is disabled
Date: Sat, 28 Nov 2020 22:47:18 +1100	[thread overview]
Message-ID: <20201128114718.GC473773@balbir-desktop> (raw)
In-Reply-To: <20201127194900.b66f2627a3d52529e401a6f1@linux-foundation.org>

On Fri, Nov 27, 2020 at 07:49:00PM -0800, Andrew Morton wrote:
> On Fri, 27 Nov 2020 20:21:11 +1100 Balbir Singh <bsingharora@gmail.com> wrote:
> 
> > On Thu, Nov 26, 2020 at 01:10:18PM +0100, Vlastimil Babka wrote:
> > > On 11/26/20 5:30 AM, Balbir Singh wrote:
> > > > When alloc_super() allocates list_lrus for dentries and inodes
> > > > they are made memcg aware if KMEM is compiled in, we should
> > > > also check if kmem was disabled at runtime.
> > > > 
> > > > This overhead is about 32 bytes extra per possible nodes per caller
> > > > of list_lru_init()
> > > > 
> > > > Signed-off-by: Balbir Singh <bsingharora@gmail.com>
> > > 
> > > I'd rather export cgroup_memory_nokmem and make cgroup_kmem_disabled()
> > > inline, put it next to memcg_kmem_enabled() and explain in comments what
> > > each means.
> > > 
> > > And ideally, the current memcg_kmem_enabled() should be named e.g.
> > > memcg_kmem_active(), and then the new cgroup_kmem_disabled() could be named
> > > memcg_kmem_enabled(). But that's churn and potential future backport hazard,
> > > so dunno.
> > 
> > Yes, I am happy with whatever approach works to fast track the patches
> > 
> > Andrew, thoughts/comments?
> > 
> 
> Your original changelog doesn't make the case that the patch should be
> fast tracked, so it looks like there's missing information.  Please
> don't miss information ;)
>

I just wanted to get the patches done :) Nothing to be seriously backported.
I can refactor the code, I've seen cases where even with kmem disabled on
pressure, kvmalloc leads to wasting memory for allocating memcg aware list_lrus.

With older kernels (5.4 and before) where, creation of a new namespace
always caused these allocations to occur via pid_ns_prepare_proc(), the issue
is quite obviously exposed - the waster is a function of

wasted_memory = sizeof (list_lru_memcg+4) * number of nodes * number of memcgs with
kmem enabled ( per clone/container ) -- (1)

That's not too bad today, but I am afraid it's useless memory being allocated
and can become larger if the number of possible nodes increase.



 
> If we're looking for a backportable quickfix for the
> not-yet-really-explained problem then yes, Vlastimil's suggestion (as a
> high-priority patch and a separate low-priority patch) sounds good.
> 
> It is rather a twisty maze of identifiers, so please do comment
> everything well.

Yes, I am going to refactor things out a bit and resend the patches

Balbir Singh.


      reply	other threads:[~2020-11-28 11:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26  4:30 [PATCH] mm/list_lru: dont make them memcg aware if kmem is disabled Balbir Singh
2020-11-26 12:10 ` Vlastimil Babka
2020-11-27  9:21   ` Balbir Singh
2020-11-28  3:49     ` Andrew Morton
2020-11-28 11:47       ` Balbir Singh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201128114718.GC473773@balbir-desktop \
    --to=bsingharora@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=vbabka@suse.cz \
    --cc=vdavydov.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).