[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <BE9C605A-2719-4738-A084-067E780A7108@linux.dev>
Date: Tue, 14 Feb 2023 11:54:35 +0800
From: Muchun Song <muchun.song@...ux.dev>
To: Roman Gushchin <roman.gushchin@...ux.dev>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Shakeel Butt <shakeelb@...gle.com>,
Dennis Zhou <dennis@...nel.org>,
Linux Memory Management List <linux-mm@...ck.org>
Subject: Re: [PATCH] mm: memcontrol: rename memcg_kmem_enabled()
> On Feb 14, 2023, at 03:29, Roman Gushchin <roman.gushchin@...ux.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@...ux.dev>
It's more clear.
Acked-by: Muchun Song <songmuchun@...edance.com>
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.
Thanks.
Powered by blists - more mailing lists