Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: memcontrol: let v2 cgroups follow changes in system swappiness

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 <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Cc: <stable@vger.kernel.org> [4.5]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Johannes Weiner and committed by
Linus Torvalds
4550c4e1 145bdaa1

+4
+4
include/linux/swap.h
··· 533 533 #ifdef CONFIG_MEMCG 534 534 static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg) 535 535 { 536 + /* Cgroup2 doesn't have per-cgroup swappiness */ 537 + if (cgroup_subsys_on_dfl(memory_cgrp_subsys)) 538 + return vm_swappiness; 539 + 536 540 /* root ? */ 537 541 if (mem_cgroup_disabled() || !memcg->css.parent) 538 542 return vm_swappiness;