[Devel] [PATCH rh7 3/3] mm/workingset: Fix memcg_inc_ws_activate() with disabled mem cgroups.
Andrey Ryabinin
aryabinin at virtuozzo.com
Fri May 17 16:08:02 MSK 2019
When mem cgroups are disabled memcg_inc_ws_activate might be called with
NULL memcg and crash. Fix it.
Fixes: f6a8b015027e ("ms/mm: workingset: per-cgroup cache thrash detection")
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
mm/memcontrol.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 301fedcbc312..929dbdbb72c8 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1143,6 +1143,9 @@ unsigned long memcg_ws_activates(struct mem_cgroup *memcg)
void memcg_inc_ws_activate(struct mem_cgroup *memcg)
{
+ if (mem_cgroup_disabled())
+ return;
+
percpu_counter_inc(&memcg->stat2.counters[MEM_CGROUP_STAT_WS_ACTIVATE]);
}
--
2.21.0
More information about the Devel
mailing list