Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp947245img; Thu, 28 Feb 2019 10:22:03 -0800 (PST) X-Google-Smtp-Source: APXvYqyDpu59/FjL/Wn8eCOmX0hjcb3Fnyyg8C8IS/qlQ73bHY8mGDx2Mp5qra48Lrm9hoSZqkyN X-Received: by 2002:a62:1b92:: with SMTP id b140mr925198pfb.159.1551378123235; Thu, 28 Feb 2019 10:22:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551378123; cv=none; d=google.com; s=arc-20160816; b=M4VOTV+0UCpxnjZ7hTadMvIWIBi9aJXpoBxCbZdefy75APjBXiJOPC/1Hs1qYMqX8D Rhi8qkxJoUmeXnAC3eQGKxx31e8qMZmeECTUrq/B77uGEhIXCJfrg0pthNEacFtWE7nP 9yrkP6JaD8iPQ7hfArSv4vO+l/prnolj5/Eg3QiPU9wXM/KRujD5abuJ0cSCcSJz5eDM HaaYLZYKit+XHWFPc08GhxjbUw7aQ9ddvK59rVnFY2zIdWihcelWQnrshAY7PMzmbotH 6eGOoEiSpPi+qZ1BmLtc7FH7iHJWE9wAQCh/9Ft99Vxqxpz5MHye/yRsNQLPnjfYY3E6 V47w== 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=xYRD3i2lO0S8FmpT0yhEIbRdeHMhHjlJuWkUHWcpJsw=; b=JbIFyR7Vd0PKbD0cMhw/lzRHYwFvDjMizInImdDPPjvAQRVRc5qJpy7NLE8AIGFXWC 86Iu5vL2uostkLO1d/wKXQLBD8rvW6qJLwhZnkFm/b3dwKe+UQObB2hBjylq65g/tHM8 29962R8NeNzYcHkaCtVjT7ifkqwblet0fgtzm8dK7rvZJtZfFzyLR52bmQ/So/Zu/GZh 0RC8oPTwDyYUxzmPoT6p/IuXvG6wp8dq70thz+/RFOtJH3u/d9aYdocn5M3KrE14pl2T qOy/FEkh8MCH4vlPQeDPYglMlYlQ1zekydrMVlS24Q7VLzWnzifeY70XJKurqePZqPYF wV9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=qZBcQtun; 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 u26si12447705pgn.216.2019.02.28.10.21.47; Thu, 28 Feb 2019 10:22:03 -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=qZBcQtun; 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 S1732953AbfB1Qay (ORCPT + 99 others); Thu, 28 Feb 2019 11:30:54 -0500 Received: from mail-yw1-f65.google.com ([209.85.161.65]:41866 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732789AbfB1Qat (ORCPT ); Thu, 28 Feb 2019 11:30:49 -0500 Received: by mail-yw1-f65.google.com with SMTP id q128so11528984ywg.8 for ; Thu, 28 Feb 2019 08:30:49 -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=xYRD3i2lO0S8FmpT0yhEIbRdeHMhHjlJuWkUHWcpJsw=; b=qZBcQtunj0HpdKLEyd50kzMF5u4hwQOvpkuAEd9NtT3C1jIdB7SHj5Wu9SVJiJwk3c efLEI5hR9LP5jqeXRHv91q1Cfi7QKY7YBX/nYdAjWaCkhg0/6IEOPiQBjKAq0bfilI3N 6+YUWT4QM7QuO2aTXzGCOAO03Gu8MEqoAFGi1AsO2Gy+6MSFPDuRjpmStKdiUf3gl9WQ rYJWUi4TxMM1rVZuaDh8gqG2aQjHBJ/peVLRMFwX1ONsJbyvqNoiueg8XQ0q6ZlZTrDO AmmgTrAeqcwX3nf/JCr/thMhQEdk6+oBM8aZcyfJ5f8xItULOYhkQICIPL/RS7FEkfXS 5ByA== 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=xYRD3i2lO0S8FmpT0yhEIbRdeHMhHjlJuWkUHWcpJsw=; b=f+21zEXnhUeYqgsjjWccpXFOHXYoh2IZQnzuLR/jOtypWff0eqXH8/Lot6O0fEVZiP GeEIJz5Zmwe+keo7Z+SLiqlyX/BgsfgDSCy5rAd7uoEqEPILzCehJhKrACs0Y0uS323R +HQ8blUI2dqRfCtsXZ8iI34w5OkP6ugtPEpR2FMRkVIN2Ds8OU01mpIocImsu/UAyIJK g6yvcB9rhR5k1xJ4muBzYB0ZUbRgYlIj3FXJ2lvf2BklrK6NfXKaX8XTIwfZfzCRBjXc LYdOL02P5zUO0GFM+3A7Id8IqvJTzLL9X5AqgaJ7MEhSi2Ahg57OHHe3BrKhCsK5COTh Lb7Q== X-Gm-Message-State: AHQUAubNLGoOcmsvYcB9b1LdZ9V0UxWLUvtqPZt+165/ZpwWPpOZHfIw dsSJh8j4KRiLem/y3nFWRhouJw== X-Received: by 2002:a81:3083:: with SMTP id w125mr6232560yww.170.1551371448843; Thu, 28 Feb 2019 08:30:48 -0800 (PST) Received: from localhost ([2620:10d:c091:200::3:da64]) by smtp.gmail.com with ESMTPSA id e3sm6679734ywe.33.2019.02.28.08.30.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Feb 2019 08:30:48 -0800 (PST) From: Johannes Weiner To: Andrew Morton Cc: Tejun Heo , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 5/6] mm: memcontrol: push down mem_cgroup_nr_lru_pages() Date: Thu, 28 Feb 2019 11:30:19 -0500 Message-Id: <20190228163020.24100-6-hannes@cmpxchg.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228163020.24100-1-hannes@cmpxchg.org> References: <20190228163020.24100-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 mem_cgroup_nr_lru_pages() is just a convenience wrapper around memcg_page_state() that takes bitmasks of lru indexes and aggregates the counts for those. Replace callsites where the bitmask is simple enough with direct memcg_page_state() call(s). Signed-off-by: Johannes Weiner --- mm/memcontrol.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index ad6214b3d20b..76f599fbbbe8 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1361,7 +1361,7 @@ void mem_cgroup_print_oom_meminfo(struct mem_cgroup *memcg) for (i = 0; i < NR_LRU_LISTS; i++) pr_cont(" %s:%luKB", mem_cgroup_lru_names[i], - K(mem_cgroup_nr_lru_pages(iter, BIT(i)))); + K(memcg_page_state(iter, NR_LRU_BASE + i))); pr_cont("\n"); } @@ -3016,8 +3016,8 @@ static void accumulate_vmstats(struct mem_cgroup *memcg, ? acc->vmevents_array[i] : i); for (i = 0; i < NR_LRU_LISTS; i++) - acc->lru_pages[i] += - mem_cgroup_nr_lru_pages(mi, BIT(i)); + acc->lru_pages[i] += memcg_page_state(mi, + NR_LRU_BASE + i); } } @@ -3447,7 +3447,8 @@ static int memcg_stat_show(struct seq_file *m, void *v) for (i = 0; i < NR_LRU_LISTS; i++) seq_printf(m, "%s %lu\n", mem_cgroup_lru_names[i], - mem_cgroup_nr_lru_pages(memcg, BIT(i)) * PAGE_SIZE); + memcg_page_state(memcg, NR_LRU_BASE + i) * + PAGE_SIZE); /* Hierarchical information */ memory = memsw = PAGE_COUNTER_MAX; @@ -3937,8 +3938,8 @@ void mem_cgroup_wb_stats(struct bdi_writeback *wb, unsigned long *pfilepages, /* this should eventually include NR_UNSTABLE_NFS */ *pwriteback = memcg_page_state(memcg, NR_WRITEBACK); - *pfilepages = mem_cgroup_nr_lru_pages(memcg, (1 << LRU_INACTIVE_FILE) | - (1 << LRU_ACTIVE_FILE)); + *pfilepages = memcg_page_state(memcg, NR_INACTIVE_FILE) + + memcg_page_state(memcg, NR_ACTIVE_FILE); *pheadroom = PAGE_COUNTER_MAX; while ((parent = parent_mem_cgroup(memcg))) { -- 2.20.1