lkml.org 
[lkml]   [2019]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] mm, memcg: Handle cgroup_disable=memory when getting memcg protection
memcg is NULL if we have CONFIG_MEMCG set, but cgroup_disable=memory on
the kernel command line.

Fixes: 8a907cdf0177ab40 ("mm, memcg: proportional memory.{low,min} reclaim")
Reported-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Signed-off-by: Chris Down <chris@chrisdown.name>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org
Cc: cgroups@vger.kernel.org
Cc: linux-mm@kvack.org
---
include/linux/memcontrol.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 290cfbfd60cd..49742489aa56 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -335,6 +335,9 @@ static inline bool mem_cgroup_disabled(void)

static inline unsigned long mem_cgroup_protection(struct mem_cgroup *memcg)
{
+ if (mem_cgroup_disabled())
+ return 0;
+
return max(READ_ONCE(memcg->memory.emin), READ_ONCE(memcg->memory.elow));
}

--
2.20.1
\
 
 \ /
  Last update: 2019-02-01 05:58    [W:3.306 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site