Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp236962img; Thu, 21 Mar 2019 18:57:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJQ7/+PztZy5Ty/UuTndu1pca3I+ggRj933lESGBB2oFkvaXofmGCPSHpSJ3j7c4aKCLoI X-Received: by 2002:a17:902:7242:: with SMTP id c2mr6699009pll.245.1553219860654; Thu, 21 Mar 2019 18:57:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553219860; cv=none; d=google.com; s=arc-20160816; b=q45CZl3GFr5VzIhI9mVzQAxDYeQ5SBqNp4truGhAirRlMVsO76r3KZ9fKVTbAkDYmr ztH8vtd9ZR+01jyv0mH1VA+muXv5qc4tREl9tanFzbhXTx3fXKA7iGzXmq2kisjig7T9 L1Zs04lN/okIHbhVDk3zLwhhFS1ybAh8+gmhi+N2/NQhC7Ydu83iu1t8Uzyrnrw20d8M QxEb5TJIB11PNmTL67hOap1T9dZPv7mbOx6jdmMuqZhG8NwD5mTshgSJrN/qA+UDLTGA INk9o7mkTWgcIsJv8b7a2VmKSHkzbJQaM3qwX7Qfr4yKUYZVlRcz7telZdR2D5epltA2 dtrQ== 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:subject:cc:to:from:date; bh=NiLJVxi7wTZ95EAX9x6HxyZT7a9pIqkd9z3QZI63BgI=; b=yT13HNKedNjLW4LSnD/vD2h7B/ydM7xEXhEUHk6jhTEQjgaB25R0vFiUwdAID5UCv/ VSMVyNx/ZdoQgXM2X3D7cDpo9kjS0xt7pD1yiHBbEbsiAJtGrgccurzMpwGZZ+qDxIwv aENeWxNPRh44LaLgA7ZOw/ru6jTCP8Oz7xyLZX6ZHqCWb0SCA6KrfzVLMtmcPQxqoilC /m4qPWS92sQXSAmeMFVOEl1hiCkNmltKvw3KDl+bw/lEetUvhCuKDaVi+NWZWsd/uZ6I QXFLtxJPFojyR3uZwVGL42mYZFJOCNb0TqaL+gDPF0yu9W8sootY31g600IMR0XjTEB6 aYEQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f66si5815950pfb.261.2019.03.21.18.57.26; Thu, 21 Mar 2019 18:57:40 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727674AbfCVByz (ORCPT + 99 others); Thu, 21 Mar 2019 21:54:55 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42396 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727549AbfCVByz (ORCPT ); Thu, 21 Mar 2019 21:54:55 -0400 Received: from localhost.localdomain (c-73-223-200-170.hsd1.ca.comcast.net [73.223.200.170]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 33DD4E48; Fri, 22 Mar 2019 01:54:54 +0000 (UTC) Date: Thu, 21 Mar 2019 18:54:53 -0700 From: Andrew Morton To: Johannes Weiner Cc: Tejun Heo , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 3/6] mm: memcontrol: replace node summing with memcg_page_state() Message-Id: <20190321185453.6458679180e1e41893e7312b@linux-foundation.org> In-Reply-To: <20190228163020.24100-4-hannes@cmpxchg.org> References: <20190228163020.24100-1-hannes@cmpxchg.org> <20190228163020.24100-4-hannes@cmpxchg.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 28 Feb 2019 11:30:17 -0500 Johannes Weiner wrote: > Instead of adding up the node counters, use memcg_page_state() to get > the memcg state directly. This is a bit cheaper and more stream-lined. > > ... > > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -746,10 +746,13 @@ static unsigned long mem_cgroup_nr_lru_pages(struct mem_cgroup *memcg, > unsigned int lru_mask) > { > unsigned long nr = 0; > - int nid; > + enum lru_list lru; > > - for_each_node_state(nid, N_MEMORY) > - nr += mem_cgroup_node_nr_lru_pages(memcg, nid, lru_mask); > + for_each_lru(lru) { > + if (!(BIT(lru) & lru_mask)) > + continue; > + nr += memcg_page_state(memcg, NR_LRU_BASE + lru); > + } Might be able to use for_each_set_bit(&lru_mnask) here, but it's much of a muchness.