Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp182274imj; Fri, 15 Feb 2019 21:09:48 -0800 (PST) X-Google-Smtp-Source: AHgI3IYn+XW1P0Tbu9+fPBPR+zNO8A7zjKCjuHY6Dkhz2JDGzUCUKK3WYKt8zXAXZ7hal/IxS70s X-Received: by 2002:a63:1544:: with SMTP id 4mr8844625pgv.290.1550293788521; Fri, 15 Feb 2019 21:09:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550293788; cv=none; d=google.com; s=arc-20160816; b=RfHbBV27fSp3tZ5dhViMaBLDZ4HZHJsscLBE1K5FcAmQxzSDOQEc45Ca/dj9cm/W1P i7VvMc2hZPosoolIed0qOk7HqMdNiLEtiYs1SLvK/qn0hf0wUd3n1vildjyD1PXozAXX jf4NU7+OWBX5/85A8r1hx8o3iUHIEJ9fDp+BzFrh2vh5liU5Y3LRbPuo4p9dLymejoiW Akk4vDDsz2aJ51JpzBdKNXJEGpKqeAs24mT7wpgxbs1gnbEJwbgB/O1vNoWwXVVS3WtN zEGKoVsB5U1IAy/HPWB/MZgjyFXbLFmq3cCPnBGvjBcJsxhvSUge5xlDSRVV4NoAIVs9 D7dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5xWYBy7FokRZPZ5ORH4t2tIovmpTYMvN2BW/u6oRAco=; b=Pf9XdabBzfRpujPA6BP1N+tlsuI9+54nDZHEEuUvIO8FjI46G9bmoyk02tl61MExd0 sJSRfMX+JLRrr31Nq00+0C8beTGEhsflVCcKmdR1ed2PPdj/PPrUSAOifa9ZCI6FeIQb djvcnC++EXrAyUtGF359brApVTP08E3VFZl4WPfP+Yn7H4upLlCGmcaPkrBw9a+bPYH5 yIlJ4h7JNJj+FTl3IjWqfDwa3vGm/Bng9OsIJIzSjFaw+MxtTDloR7yGEPMhuycYWv9B 5YLMF1/PSYHUio+pwVmgq8mOc3Pdt87CDcnzQvSHlQCepSo9jA0Zv4yEQfXnWLU7PNRg d+YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=b1VUPdwi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u11si2048482plr.227.2019.02.15.21.09.32; Fri, 15 Feb 2019 21:09:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=b1VUPdwi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388821AbfBOSOx (ORCPT + 99 others); Fri, 15 Feb 2019 13:14:53 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:36770 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388334AbfBOSOk (ORCPT ); Fri, 15 Feb 2019 13:14:40 -0500 Received: by mail-yw1-f66.google.com with SMTP id 189so4048968ywi.3 for ; Fri, 15 Feb 2019 10:14:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5xWYBy7FokRZPZ5ORH4t2tIovmpTYMvN2BW/u6oRAco=; b=b1VUPdwiUPbev9Zpm14NFF7dG9RjRJ3CzCdRRh5szC6PsrCzTDT8Xq0B2F1nEGlhxg qLhGQzYmivMBrSqb1WHcfnJaVtqKBqsYcBHRV4yQm+PMcovxgqEyKvjTF3SBy9eqKQbd Lm96Dn86Q1ft5hiblalQn3NM7tmzMYt1R3rWpT0M8h+pBwAqTSYMf91gdqc8HhOAu2QG +9shVyCnT2FUiU6uA36Dr3ebjESZRYa3f92YsgtnnKh4zE35w+MtNwG65NANGZLesYqd O0A1bV3uYF8ost+QXKnAa+CYQvmbBuk36tzQdSADml/ekVJPwD4FM3LK4Npp7pBx/UEc UsmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5xWYBy7FokRZPZ5ORH4t2tIovmpTYMvN2BW/u6oRAco=; b=ALtvEq2dRhuui7WLWp9IfX88L7yRmiZJTvHFm4T9qrynvTuSfWmaJG0HU7Gp0UIJVv EZ5MHhl3E9lACo2K+vHMIzW4fIyzR16C5qEbXUYK8yGNVsn33jx4Qed9y8zpljFxz66P o98tRfuZqwagB2Akqp/69DUeLltif6SR4JYLIyWyGG/DY1EzplgE5REIbFWZRBGre7gH S2Dcz70qpw7Yx0UwgWhgpSJeWOZ9E3JCl047uTkks7W+RjDMkriyW0n1tUzGp0zLNrVR UtvJxg7rhlmZGRfrWOG8+yUObOXoehi+mR9QHcL6j3AL9EuKRaDn+2JjI8IqWoL6+93s Xtkg== X-Gm-Message-State: AHQUAuZev6RF7Zw/qcuWvUBiOAElC8Pv1/PGN8+rISnCg/jrX1w5Ek5T /5TQjaS68UF7ZTDD0bDh7GxzcH8qa+0= X-Received: by 2002:a81:7a50:: with SMTP id v77mr8974055ywc.223.1550254479646; Fri, 15 Feb 2019 10:14:39 -0800 (PST) Received: from localhost ([2620:10d:c091:200::4:33c1]) by smtp.gmail.com with ESMTPSA id j22sm1915745ywj.37.2019.02.15.10.14.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Feb 2019 10:14:39 -0800 (PST) From: Johannes Weiner To: Andrew Morton Cc: Tejun Heo , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 6/6] mm: memcontrol: quarantine the mem_cgroup_[node_]nr_lru_pages() API Date: Fri, 15 Feb 2019 13:14:25 -0500 Message-Id: <20190215181425.32624-7-hannes@cmpxchg.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190215181425.32624-1-hannes@cmpxchg.org> References: <20190215181425.32624-1-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Only memcg_numa_stat_show() uses those wrappers and the lru bitmasks, group them together. Signed-off-by: Johannes Weiner --- include/linux/mmzone.h | 5 ---- mm/memcontrol.c | 67 +++++++++++++++++++++++------------------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 842f9189537b..a93921ba7bd6 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -247,11 +247,6 @@ struct lruvec { #endif }; -/* Mask used at gathering information at once (see memcontrol.c) */ -#define LRU_ALL_FILE (BIT(LRU_INACTIVE_FILE) | BIT(LRU_ACTIVE_FILE)) -#define LRU_ALL_ANON (BIT(LRU_INACTIVE_ANON) | BIT(LRU_ACTIVE_ANON)) -#define LRU_ALL ((1 << NR_LRU_LISTS) - 1) - /* Isolate unmapped file */ #define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x2) /* Isolate for asynchronous migration */ diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 6d0c3374669f..20fb3de8bde4 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -718,37 +718,6 @@ static void mem_cgroup_charge_statistics(struct mem_cgroup *memcg, __this_cpu_add(memcg->stat_cpu->nr_page_events, nr_pages); } -static unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, - int nid, unsigned int lru_mask) -{ - struct lruvec *lruvec = mem_cgroup_lruvec(NODE_DATA(nid), memcg); - unsigned long nr = 0; - enum lru_list lru; - - VM_BUG_ON((unsigned)nid >= nr_node_ids); - - for_each_lru(lru) { - if (!(BIT(lru) & lru_mask)) - continue; - nr += lruvec_page_state(lruvec, NR_LRU_BASE + lru); - } - return nr; -} - -static unsigned long mem_cgroup_nr_lru_pages(struct mem_cgroup *memcg, - unsigned int lru_mask) -{ - unsigned long nr = 0; - enum lru_list lru; - - for_each_lru(lru) { - if (!(BIT(lru) & lru_mask)) - continue; - nr += memcg_page_state(memcg, NR_LRU_BASE + lru); - } - return nr; -} - static bool mem_cgroup_event_ratelimit(struct mem_cgroup *memcg, enum mem_cgroup_events_target target) { @@ -3328,6 +3297,42 @@ static int mem_cgroup_move_charge_write(struct cgroup_subsys_state *css, #endif #ifdef CONFIG_NUMA + +#define LRU_ALL_FILE (BIT(LRU_INACTIVE_FILE) | BIT(LRU_ACTIVE_FILE)) +#define LRU_ALL_ANON (BIT(LRU_INACTIVE_ANON) | BIT(LRU_ACTIVE_ANON)) +#define LRU_ALL ((1 << NR_LRU_LISTS) - 1) + +static unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, + int nid, unsigned int lru_mask) +{ + struct lruvec *lruvec = mem_cgroup_lruvec(NODE_DATA(nid), memcg); + unsigned long nr = 0; + enum lru_list lru; + + VM_BUG_ON((unsigned)nid >= nr_node_ids); + + for_each_lru(lru) { + if (!(BIT(lru) & lru_mask)) + continue; + nr += lruvec_page_state(lruvec, NR_LRU_BASE + lru); + } + return nr; +} + +static unsigned long mem_cgroup_nr_lru_pages(struct mem_cgroup *memcg, + unsigned int lru_mask) +{ + unsigned long nr = 0; + enum lru_list lru; + + for_each_lru(lru) { + if (!(BIT(lru) & lru_mask)) + continue; + nr += memcg_page_state(memcg, NR_LRU_BASE + lru); + } + return nr; +} + static int memcg_numa_stat_show(struct seq_file *m, void *v) { struct numa_stat { -- 2.20.1