[Devel] [PATCH RHEL7 COMMIT] mm/workingset: Fix memcg_inc_ws_activate() with disabled mem cgroups.

Konstantin Khorenko khorenko at virtuozzo.com
Tue May 21 18:34:59 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.12.2.vz7.96.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.12.2.vz7.96.1
------>
commit cbc49227dc2dd604dc8b79172a21d8e3d0e34b64
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Tue May 21 18:34:56 2019 +0300

    mm/workingset: Fix memcg_inc_ws_activate() with disabled mem cgroups.
    
    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 91fb5ee896f5..d11aa24ed207 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]);
 }
 



More information about the Devel mailing list