diff options
author | Haifeng Xu <haifeng.xu@shopee.com> | 2023-12-28 07:27:14 +0100 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2024-02-22 01:00:02 +0100 |
commit | 0057db47f8785d1017a04ec1c9590e0af10eb220 (patch) | |
tree | 4ff66294fddffd4337c54080a95a28b4982450c2 /mm/list_lru.c | |
parent | mm: memory: use nth_page() in clear/copy_subpage() (diff) | |
download | linux-0057db47f8785d1017a04ec1c9590e0af10eb220.tar.xz linux-0057db47f8785d1017a04ec1c9590e0af10eb220.zip |
mm: list_lru: disable memcg_aware when cgroup.memory is set to "nokmem"
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".
Link: https://lkml.kernel.org/r/20231228062715.338672-1-haifeng.xu@shopee.com
Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
Acked-by: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Shakeel Butt <shakeelb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/list_lru.c')
-rw-r--r-- | mm/list_lru.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/list_lru.c b/mm/list_lru.c index 35b0147542a9..158781d1d3c2 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -567,6 +567,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); |