Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp183307imj; Fri, 15 Feb 2019 21:11:31 -0800 (PST) X-Google-Smtp-Source: AHgI3IYtmsEE2QWUNJbiZ0Ec3klPbETuPlPUAUA3YXOTuMNfqM1eQn0+rdfD0zwxMqO20tmQnfS2 X-Received: by 2002:a62:b15:: with SMTP id t21mr13742137pfi.136.1550293891684; Fri, 15 Feb 2019 21:11:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550293891; cv=none; d=google.com; s=arc-20160816; b=WJOsO5aLLVvBwjm6yz3VgNbmyF+9KjphT5gPUaGYeygY9fy4s0e8lHPfwF1sXPmyBj ehSt1J+3lDK0u6ewuXGptyIumbXZgSEJh7B53dpz/ENMZEa6rP5iZm7DlumfgVUO6ptj 8CrqqvDVeA2tqEDYxhcMnfSfw/n7TE9OXrm8OUbn0dRBcWJT6e7CPQmq5pVp4FK3VDmE OohDzAgINUXkmwJjtRh2y1d//B1Qzu5150yMEHH5Oo7FjQH6kEqGbejj/UdIdSkv1B1F h/LsiSuIYOoYO/Z3m+l9mJUVWVbHmN/UvngVFLxtMIfP/RnFuOYvb32MROJuoml7tzxG GlHw== 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=0Mi2kL/2WsC77PZT2+GFY8rm4/RmpjTroxvb9aqMFLo=; b=hEZQqZWS133+Fq8FDOEZwYoKCIMgB93L6/9bj8Xjl7RCvqwgE96gRjVQJbafAQgRCb 17atSvDM6xUYU6TCjW6yKpzgl8HpVM/35nFX3QKk7U8A9/XKxMB6v1PxT3Xmrrw2bToR vUDfCqoiHGF7DKWQVomkK/cIAr2FHsJ9VRSxDkaRd3D9o8qXl7zNcinHQ94OwzzL2VS9 fqbozyyVVBsFFxrS7V3a4N4RfaXm6I3/heBnunTkyuOHOeZxLCXMqq+zjNHIbWtoe5Nc B3EadzJYJtX8Pq/AWtP4BH5bT/q9as5vt4wxibABpL3Ocvr+VLUt3sqPUoMU+5s1rTxp FCvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=T68qNAfX; 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 b13si7568112plm.63.2019.02.15.21.11.15; Fri, 15 Feb 2019 21:11:31 -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=T68qNAfX; 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 S1732155AbfBOSPH (ORCPT + 99 others); Fri, 15 Feb 2019 13:15:07 -0500 Received: from mail-yw1-f65.google.com ([209.85.161.65]:37013 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731898AbfBOSOe (ORCPT ); Fri, 15 Feb 2019 13:14:34 -0500 Received: by mail-yw1-f65.google.com with SMTP id k14so4045194ywe.4 for ; Fri, 15 Feb 2019 10:14:33 -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=0Mi2kL/2WsC77PZT2+GFY8rm4/RmpjTroxvb9aqMFLo=; b=T68qNAfXm8z8Lj+3Sujbvrk6lrgzOm9xtKSZ/IbmFiUVElTgSyqQ2V+u8V/D9scygU xxfD6Glf1ZjEFDVjQQL1tMksAEl64SR6rxg+DSZh4qQylcB+qKG7yvncHsUD6laSivYP yrEesjRu1nLQkP3oKWLthCKmAAhpLG/cLBDhHmDEZHhlsOsBcznvipgKZKTxTcWUSIlS 3CGsUy80UjqzcUyhdj0RAav/iNiNe2XnpUFfM0WEFDf/Nju/TBXsm4AIq5xgFLVGyhme /L0ACh/CL4wCcQTp/ogKd2o1NGC+q+Wz6XVJ5SxvPfpO1E1z2MSsbYxU1mnLMYATxkqx ds+A== 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=0Mi2kL/2WsC77PZT2+GFY8rm4/RmpjTroxvb9aqMFLo=; b=XHHy5W+koJo4qkEUmFxEySr+N5b7MNSslOdRkZEsvpivHIe0+f3rclYviO3mtHZCa8 O2UUo+dVt4GN0XthjC5U35D8hKaI97Auh/x8qBxn+EUHi2cq146xm1GwHjR1V9xlQg6T r/4wJZSCFVtGvGIi1V1VP3hrSR1pmjUJhaQnJIFx++PnnnLVeVjh3yq54F2KDZdG/4xJ d+1Pm9VZ3PVkyEqFqdVoLUsjZC7H41vCZKc6vQi+CpQvc05aRaQjUeuy0MyXhsmf+yuZ 78BIdSK90g9HNmXCgC4sKLSO8dH/uDk53zXegSojzYwfU0u/59SafhrE7AAl2Lm3XDLg Xgeg== X-Gm-Message-State: AHQUAuaIIVQr4dVvp7VTtl6NfXT9gm1ErtPLzOewe4WPEfe0sGMRUEPY hJyhu03ZPhBU7Dt8EPA2w2qBKbHsFG0= X-Received: by 2002:a0d:d857:: with SMTP id a84mr9171114ywe.121.1550254473071; Fri, 15 Feb 2019 10:14:33 -0800 (PST) Received: from localhost ([2620:10d:c091:200::4:33c1]) by smtp.gmail.com with ESMTPSA id j22sm1915679ywj.37.2019.02.15.10.14.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Feb 2019 10:14:32 -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 2/6] mm: memcontrol: replace zone summing with lruvec_page_state() Date: Fri, 15 Feb 2019 13:14:21 -0500 Message-Id: <20190215181425.32624-3-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 Instead of adding up the zone counters, use lruvec_page_state() to get the node state directly. This is a bit cheaper and more stream-lined. Signed-off-by: Johannes Weiner --- include/linux/memcontrol.h | 18 ------------------ mm/memcontrol.c | 2 +- mm/vmscan.c | 2 +- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 83ae11cbd12c..206090de5d7c 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -499,19 +499,6 @@ void mem_cgroup_update_lru_size(struct lruvec *lruvec, enum lru_list lru, unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, int nid, unsigned int lru_mask); -static inline -unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru) -{ - struct mem_cgroup_per_node *mz; - unsigned long nr_pages = 0; - int zid; - - mz = container_of(lruvec, struct mem_cgroup_per_node, lruvec); - for (zid = 0; zid < MAX_NR_ZONES; zid++) - nr_pages += mz->lru_zone_size[zid][lru]; - return nr_pages; -} - static inline unsigned long mem_cgroup_get_zone_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx) @@ -947,11 +934,6 @@ static inline bool mem_cgroup_online(struct mem_cgroup *memcg) return true; } -static inline unsigned long -mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru) -{ - return 0; -} static inline unsigned long mem_cgroup_get_zone_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index af7f18b32389..a04177f25758 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -730,7 +730,7 @@ unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, for_each_lru(lru) { if (!(BIT(lru) & lru_mask)) continue; - nr += mem_cgroup_get_lru_size(lruvec, lru); + nr += lruvec_page_state(lruvec, NR_LRU_BASE + lru); } return nr; } diff --git a/mm/vmscan.c b/mm/vmscan.c index e979705bbf32..f88fef03fc04 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -346,7 +346,7 @@ unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone int zid; if (!mem_cgroup_disabled()) - lru_size = mem_cgroup_get_lru_size(lruvec, lru); + lru_size = lruvec_page_state(lruvec, NR_LRU_BASE + lru); else lru_size = node_page_state(lruvec_pgdat(lruvec), NR_LRU_BASE + lru); -- 2.20.1