From: Johannes Weiner Date: Thu, 5 May 2016 23:22:03 +0000 (-0700) Subject: mm: memcontrol: let v2 cgroups follow changes in system swappiness X-Git-Tag: v4.5.4~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=948a36c33ff066b57600a8af3159132ff480380f;p=thirdparty%2Fkernel%2Fstable.git mm: memcontrol: let v2 cgroups follow changes in system swappiness commit 4550c4e157ca3da929593bb6c64080a59141af35 upstream. Cgroup2 currently doesn't have a per-cgroup swappiness setting. We might want to add one later - that's a different discussion - but until we do, the cgroups should always follow the system setting. Otherwise it will be unchangeably set to whatever the ancestor inherited from the system setting at the time of cgroup creation. Signed-off-by: Johannes Weiner Acked-by: Michal Hocko Acked-by: Vladimir Davydov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- diff --git a/include/linux/swap.h b/include/linux/swap.h index d18b65c53dbb8..5fa4aa4ddd05a 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -533,6 +533,10 @@ static inline swp_entry_t get_swap_page(void) #ifdef CONFIG_MEMCG static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg) { + /* Cgroup2 doesn't have per-cgroup swappiness */ + if (cgroup_subsys_on_dfl(memory_cgrp_subsys)) + return vm_swappiness; + /* root ? */ if (mem_cgroup_disabled() || !memcg->css.parent) return vm_swappiness;