Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758606AbcDHWtS (ORCPT ); Fri, 8 Apr 2016 18:49:18 -0400 Received: from gum.cmpxchg.org ([85.214.110.215]:49920 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751797AbcDHWtR (ORCPT ); Fri, 8 Apr 2016 18:49:17 -0400 From: Johannes Weiner To: Andrew Morton Cc: Michal Hocko , Vladimir Davydov , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH] mm: memcontrol: let v2 cgroups follow changes in system swappiness Date: Fri, 8 Apr 2016 18:49:04 -0400 Message-Id: <1460155744-15942-1-git-send-email-hannes@cmpxchg.org> X-Mailer: git-send-email 2.8.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1009 Lines: 29 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 Cc: stable@vger.kernel.org # 4.5 --- include/linux/swap.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/swap.h b/include/linux/swap.h index e58dba3..15d17c8 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -534,6 +534,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; -- 2.8.0