From: Vlastimil Babka <vbabka@suse.cz>
To: Muchun Song <songmuchun@bytedance.com>,
akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org,
vdavydov.dev@gmail.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: memcontrol: make cgroup_memory_nokmem static
Date: Tue, 16 Nov 2021 18:27:21 +0100 [thread overview]
Message-ID: <206e47d2-64da-babe-17d1-da846fbba959@suse.cz> (raw)
In-Reply-To: <20211109065418.21693-1-songmuchun@bytedance.com>
On 11/9/21 07:54, Muchun Song wrote:
> The commit 494c1dfe855e ("mm: memcg/slab: create a new set of kmalloc-cg-<n>
> caches") makes cgroup_memory_nokmem global, however, it is unnecessary
> because there is already a function mem_cgroup_kmem_disabled() which
> exports it.
>
> Just make it static and replace it with mem_cgroup_kmem_disabled()
> in mm/slab_common.c.
>
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> mm/internal.h | 5 -----
> mm/memcontrol.c | 2 +-
> mm/slab_common.c | 2 +-
> 3 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/mm/internal.h b/mm/internal.h
> index 18256e32a14c..ad15251d7a3c 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -137,11 +137,6 @@ extern void putback_lru_page(struct page *page);
> extern pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address);
>
> /*
> - * in mm/memcontrol.c:
> - */
> -extern bool cgroup_memory_nokmem;
> -
> -/*
> * in mm/page_alloc.c
> */
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 8f1d9c028897..89fc3ca65b2d 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -84,7 +84,7 @@ EXPORT_PER_CPU_SYMBOL_GPL(int_active_memcg);
> static bool cgroup_memory_nosocket __ro_after_init;
>
> /* Kernel memory accounting disabled? */
> -bool cgroup_memory_nokmem __ro_after_init;
> +static bool cgroup_memory_nokmem __ro_after_init;
>
> /* Whether the swap controller is active */
> #ifdef CONFIG_MEMCG_SWAP
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index e5d080a93009..d05203a11201 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -849,7 +849,7 @@ new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags)
> if (type == KMALLOC_RECLAIM) {
> flags |= SLAB_RECLAIM_ACCOUNT;
> } else if (IS_ENABLED(CONFIG_MEMCG_KMEM) && (type == KMALLOC_CGROUP)) {
> - if (cgroup_memory_nokmem) {
> + if (mem_cgroup_kmem_disabled()) {
> kmalloc_caches[type][idx] = kmalloc_caches[KMALLOC_NORMAL][idx];
> return;
> }
>
prev parent reply other threads:[~2021-11-16 17:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-09 6:54 [PATCH] mm: memcontrol: make cgroup_memory_nokmem static Muchun Song
2021-11-10 1:56 ` Chris Down
2021-11-16 17:27 ` Vlastimil Babka [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=206e47d2-64da-babe-17d1-da846fbba959@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=songmuchun@bytedance.com \
--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).