From 59118c42a60b997d277ad04d2309a6ec30682e5e Mon Sep 17 00:00:00 2001 From: Yang Shi Date: Tue, 5 Mar 2019 15:48:02 -0800 Subject: mm: swap: use mem_cgroup_is_root() instead of deferencing css->parent mem_cgroup_is_root() is the preferred API to check if memcg is root or not. Use it instead of deferencing css->parent. Link: http://lkml.kernel.org/r/1547232913-118148-1-git-send-email-yang.shi@linux.alibaba.com Signed-off-by: Yang Shi Acked-by: Michal Hocko Cc: Huang Ying Cc: Tim Chen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/swap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/linux/swap.h') diff --git a/include/linux/swap.h b/include/linux/swap.h index 622025ac1461..649529be91f2 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -625,7 +625,7 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg) return vm_swappiness; /* root ? */ - if (mem_cgroup_disabled() || !memcg->css.parent) + if (mem_cgroup_disabled() || mem_cgroup_is_root(memcg)) return vm_swappiness; return memcg->swappiness; -- cgit v1.2.3