]> Git Repo - linux.git/commitdiff
mm: list_lru: disable memcg_aware when cgroup.memory is set to "nokmem"
authorHaifeng Xu <[email protected]>
Thu, 28 Dec 2023 06:27:14 +0000 (06:27 +0000)
committerAndrew Morton <[email protected]>
Thu, 22 Feb 2024 00:00:02 +0000 (16:00 -0800)
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/[email protected]
Signed-off-by: Haifeng Xu <[email protected]>
Acked-by: Roman Gushchin <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Shakeel Butt <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
mm/list_lru.c

index 35b0147542a9ded5f906ce1066c2ea702349d3ae..158781d1d3c215d3fdbe7a4586f6c48e5fa880bf 100644 (file)
@@ -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);
This page took 0.060554 seconds and 4 git commands to generate.