From: Haifeng Xu <haifeng.xu@shopee.com>
To: roman.gushchin@linux.dev
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org,
shakeelb@google.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Haifeng Xu <haifeng.xu@shopee.com>
Subject: [PATCH 1/2] mm: list_lru: disable memcg_aware when cgroup.memory is set to "nokmem"
Date: Thu, 28 Dec 2023 06:27:14 +0000 [thread overview]
Message-ID: <20231228062715.338672-1-haifeng.xu@shopee.com> (raw)
Actually, when using a boot time kernel option "cgroup.memory=nokmem",
all lru items are inserted to list_lru_node. But for those users who
invoke list_lru_init_memcg() to initialize list_lru, list_lru_memcg_aware()
returns true. And this brings unneeded operations related to memcg.
To make things more convenient, let's disable memcg_aware when
cgroup.memory is set to "nokmem".
Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
---
mm/list_lru.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/list_lru.c b/mm/list_lru.c
index a05e5bef3b40..86f63c92fd88 100644
--- a/mm/list_lru.c
+++ b/mm/list_lru.c
@@ -566,6 +566,9 @@ int __list_lru_init(struct list_lru *lru, bool memcg_aware,
lru->shrinker_id = shrinker->id;
else
lru->shrinker_id = -1;
+
+ if (mem_cgroup_kmem_disabled())
+ memcg_aware = false;
#endif
lru->node = kcalloc(nr_node_ids, sizeof(*lru->node), GFP_KERNEL);
--
2.25.1
next reply other threads:[~2023-12-28 6:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-28 6:27 Haifeng Xu [this message]
2024-01-03 1:53 ` Roman Gushchin
2024-01-08 6:49 ` Haifeng Xu
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=20231228062715.338672-1-haifeng.xu@shopee.com \
--to=haifeng.xu@shopee.com \
--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=roman.gushchin@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