linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Roman Gushchin <roman.gushchin@linux.dev>
To: Muchun Song <muchun.song@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@kernel.org>,
	Shakeel Butt <shakeelb@google.com>,
	Dennis Zhou <dennis@kernel.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [PATCH] mm: memcontrol: rename memcg_kmem_enabled()
Date: Tue, 14 Feb 2023 10:19:55 -0800	[thread overview]
Message-ID: <Y+vQy8Qqj2kR86G0@P9FQF9L96D> (raw)
In-Reply-To: <BE9C605A-2719-4738-A084-067E780A7108@linux.dev>

On Tue, Feb 14, 2023 at 11:54:35AM +0800, Muchun Song wrote:
> 
> 
> > On Feb 14, 2023, at 03:29, Roman Gushchin <roman.gushchin@linux.dev> wrote:
> > 
> > Currently there are two kmem-related helper functions with a confusing
> > semantics: memcg_kmem_enabled() and mem_cgroup_kmem_disabled().
> > 
> > The problem is that an obvious expectation
> > memcg_kmem_enabled() == !mem_cgroup_kmem_disabled(),
> > can be false.
> > 
> > mem_cgroup_kmem_disabled() is similar to mem_cgroup_disabled(): it
> > returns true only if CONFIG_MEMCG_KMEM is not set or the kmem
> > accounting is disabled using a boot time kernel option
> > "cgroup.memory=nokmem". It never changes the value dynamically.
> > 
> > memcg_kmem_enabled() is different: it always returns false until
> > the first non-root memory cgroup will get online (assuming the kernel
> > memory accounting is enabled). It's goal is to improve the performance
> > on systems without the cgroupfs mounted/memory controller enabled or
> > on the systems with only the root memory cgroup.
> > 
> > To make things more obvious and avoid potential bugs, let's rename
> > memcg_kmem_enabled() to memcg_kmem_online().
> > 
> > Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
> 
> It's more clear.
> 
> Acked-by: Muchun Song <songmuchun@bytedance.com>

Thank you!

> 
> BTW, I also dislike the name of mem_cgroup_kmem_disabled, it is not
> harmonious with memcg_kmem_enabled since the prefix of one is "mem_cgroup",
> another is "memcg". Maybe we could make them more consistent. Anyway, it
> is not related to this patch.

It's a pair to mem_cgroup_disabled().

Thanks!


  reply	other threads:[~2023-02-14 18:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 19:29 Roman Gushchin
2023-02-14  3:54 ` Muchun Song
2023-02-14 18:19   ` Roman Gushchin [this message]
2023-02-14  8:31 ` Michal Hocko

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=Y+vQy8Qqj2kR86G0@P9FQF9L96D \
    --to=roman.gushchin@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=dennis@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=shakeelb@google.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