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

Konstantin Khorenko khorenko at virtuozzo.com
Tue May 28 19:07:21 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.6
------>
commit eb081deaa5c63ae3c3b4ce00a3dc6b05262ff5fb
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Tue May 28 18:54:52 2019 +0300

    mm/workingset: Fix workingset_activation() with disabled mem cgroups.
    
    When mem cgroups are disabled in workingset_activation()
    lookup_page_cgroup() can return NULL and trigger crash on next step on
    page bit check.
    
    Fixes: f6a8b015027e ("ms/mm: workingset: per-cgroup cache
    thrash detection")
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 mm/workingset.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/mm/workingset.c b/mm/workingset.c
index 1598d2b02314..f9ffc9d69f62 100644
--- a/mm/workingset.c
+++ b/mm/workingset.c
@@ -322,9 +322,12 @@ void workingset_activation(struct page *page)
 	unsigned long flags;
 
 	mem_cgroup_begin_update_page_stat(page, &locked, &flags);
-	pc = lookup_page_cgroup(page);
-	if (likely(PageCgroupUsed(pc)))
-		memcg = pc->mem_cgroup;
+	if (!mem_cgroup_disabled()) {
+		pc = lookup_page_cgroup(page);
+		if (likely(PageCgroupUsed(pc)))
+			memcg = pc->mem_cgroup;
+	}
+	/* else memcg == NULL (set above) */
 
 	/*
 	 * Filter non-memcg pages here, e.g. unmap can call



More information about the Devel mailing list