mem_cgroup_kmem_disabled() currently only checks whether the "cgroup.memory=nokmem" option is specified. However, kmem accounting is also unavailable when memcg itself is disabled. Check both conditions to ensure the function accurately reflects the kmem accounting state. Signed-off-by: Hao Li --- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 1ebceade4021..b28f6165c354 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -132,7 +132,7 @@ static DEFINE_SPINLOCK(objcg_lock); bool mem_cgroup_kmem_disabled(void) { - return cgroup_memory_nokmem; + return cgroup_memory_nokmem || mem_cgroup_disabled(); } static void memcg_uncharge(struct mem_cgroup *memcg, unsigned int nr_pages); -- 2.54.0