Re: [PATCH] mm, memcg: Handle cgroup_disable=memory when getting memcg protection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu 31-01-19 23:57:11, Chris Down wrote:
> 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")

JFYI this is not a valid sha1. It is from linux next and it will change
with the next linux-next release.

Btw. I still didn't get to look at your patch and I am unlikely to do so
today. I will be offline next week but I will try to get to it after I
get back.

> Reported-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Chris Down <chris@xxxxxxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
> Cc: Tejun Heo <tj@xxxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Cc: cgroups@xxxxxxxxxxxxxxx
> Cc: linux-mm@xxxxxxxxx
> ---
>  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

-- 
Michal Hocko
SUSE Labs



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux