From: Yang Shi <yang.shi@xxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxx Signed-off-by: Yang Shi <yang.shi@xxxxxxxxxxxxxxxxx> Acked-by: Michal Hocko <mhocko@xxxxxxxx> Cc: Huang Ying <ying.huang@xxxxxxxxx> Cc: Tim Chen <tim.c.chen@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/swap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/swap.h~mm-swap-use-mem_cgroup_is_root-instead-of-deferencing-css-parent +++ a/include/linux/swap.h @@ -625,7 +625,7 @@ static inline int mem_cgroup_swappiness( 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; _