Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp375843ybx; Wed, 6 Nov 2019 18:53:02 -0800 (PST) X-Google-Smtp-Source: APXvYqwc/6Q/h1QC2gYhqWZJfAI3GtWPpSsm1e0iSp2Oxgs1a2utyZiGPL2Hugsp3Uu8mADmSk4q X-Received: by 2002:a17:906:1f44:: with SMTP id d4mr911582ejk.16.1573095182085; Wed, 06 Nov 2019 18:53:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573095182; cv=none; d=google.com; s=arc-20160816; b=B1wo1UUUeO262vt04YOn6h88sV2D42UEvvQNYr8lEBr5sJ+P7NpmCzjF1Ib5nnUutg CnZHUL0zzh2mZ/AsdlrZi07T2aYeDK/Z3FH7K9KYj/ER46FqKQkxLyipodaLV2Lrxj5t UWT3XB5eVGYO+sMQXcGtFniC8cVQ/cpz+4A+LziJvdrZFKoa8vzKDkEYV7Y8FewPDycJ D7EXwUZo8sTb/wHDt5keSDWnx6Ij+iaWenx9bxuA7KLB8DtHtcuEDe9Oe7VsozgF/f+8 4MiBAo/hru6/rhNsLCxVXIzymioaol1OIPJ+pSGpwCjVOmQZ5+6dYkJYti2nyg4MJGT0 sTmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=GKO7/fbdppvBINU5UzZk1jxJvjGwB3qbyKeLUMFG0WY=; b=pSXCF1dMyV9EomL1ZMpyVk2RFYAK6rCVr9SjhSDyIo5Nn2eGVctl3VrIkZRU+UGerv 9KdiJF3CswQQD/2+X3gZWE9sLR987/v/U9L3eKSGCajhWuYO22aDB3mQp45gi/QXgB+e XwReKErU8tPxyuURbYPcmIEhZpQ7e+397scvtJRbwSPykvDiUeExWbeEGYiP26NLa2j8 1xzX4O3/RJzkijw0E9vkuPO7Ef9zEGtMSsFtSIQ0NfL6fC+1CnXSOArXLbqC6pk36qAd B8xjG0AKyAyERaM6bTRQ4ZJ07sUOGqZX8AZyJoPxKdKpRnb7ALKwnyIztEmR2GPMnu4Z 0pSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="lHGybIy/"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p4si547930ejo.21.2019.11.06.18.52.38; Wed, 06 Nov 2019 18:53:02 -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=@google.com header.s=20161025 header.b="lHGybIy/"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733057AbfKGCvO (ORCPT + 99 others); Wed, 6 Nov 2019 21:51:14 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:35264 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733048AbfKGCvO (ORCPT ); Wed, 6 Nov 2019 21:51:14 -0500 Received: by mail-ot1-f68.google.com with SMTP id z6so728725otb.2 for ; Wed, 06 Nov 2019 18:51:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GKO7/fbdppvBINU5UzZk1jxJvjGwB3qbyKeLUMFG0WY=; b=lHGybIy/4+Wd5Xs4rFF43Igo7QNmIxIkOuOeO28hVod0YQrbdceC97gt53BQZ/IXhX 5XUSf0vl69ZMl/BHL/QP2dXa5rAauS3uo4T33ETfaQHSlKrFGEKWmMkuA1mx95AcHix5 x+/uzcZlA1JTfMck4Lia9FP9eTVtJHq8rJTe6Zd977QZlsYRi4cOhgWUCFGnv2iXZiyA 1qfoMzmCQ3/yTKxORuIPubW5CpJM2JJczPR77EO8tyN+1q5X8jHiaB+vPpZ2r6SMTQNt f+gBkwqBIA7GiVBBHaRKE5Ooff8jHI6UtIccu7HdP9NybJy8Dp0ur2UrYxED2hpmKSPf PAUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GKO7/fbdppvBINU5UzZk1jxJvjGwB3qbyKeLUMFG0WY=; b=G/IiNykkFdbZc2RYL4pX2zgyfRwDdAyEMDg6387aMEM6ZW90pH9vA8ywcFn3J13sJi OZMQqdi8dYzLsdkDVjVGlmWybtMmylwma+XiPYykXd27xZL/OQd9NgxU92TCWE6rf1HG 2nxkxiE1uT7iP/RmZ3VrpXnFkUFXdArw/4S6uNmpW3gQD5ufjlQnh0pxqBr24kTinPI+ jo3kgkU8/Y3ve5MzSv5ONTb4w5ge78584ymvI7/HQofqXDW2EKbiwz70Z/qRyNdJDjSO XytKuYegsv28ZGfND5dKKV8T1pSfVvHR5xJeX909np8o5yOEG4Z0sBrVwKmNplNIC0+t YCgw== X-Gm-Message-State: APjAAAWwsElpINWUf35umy/CZ5M+afv1oZGaJ6XCwbTdBfvWHS5u/TnC dGwLIhVRJqlzW5XRKfQIgExCAZtkDxEHqQe7oB2r9A== X-Received: by 2002:a9d:71cc:: with SMTP id z12mr840037otj.124.1573095073108; Wed, 06 Nov 2019 18:51:13 -0800 (PST) MIME-Version: 1.0 References: <20190603210746.15800-1-hannes@cmpxchg.org> <20190603210746.15800-4-hannes@cmpxchg.org> In-Reply-To: <20190603210746.15800-4-hannes@cmpxchg.org> From: Shakeel Butt Date: Wed, 6 Nov 2019 18:51:02 -0800 Message-ID: Subject: Re: [PATCH 03/11] mm: vmscan: simplify lruvec_lru_size() To: Johannes Weiner Cc: Andrew Morton , Andrey Ryabinin , Suren Baghdasaryan , Michal Hocko , Linux MM , Cgroups , LKML , Kernel Team Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 3, 2019 at 2:59 PM Johannes Weiner wrote: > > This function currently takes the node or lruvec size and subtracts > the zones that are excluded by the classzone index of the > allocation. It uses four different types of counters to do this. > > Just add up the eligible zones. > > Signed-off-by: Johannes Weiner I think this became part of other series. Anyways: Reviewed-by: Shakeel Butt > --- > mm/vmscan.c | 19 +++++-------------- > 1 file changed, 5 insertions(+), 14 deletions(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 853be16ee5e2..69c4c82a9b5a 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -342,30 +342,21 @@ unsigned long zone_reclaimable_pages(struct zone *zone) > */ > unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx) > { > - unsigned long lru_size; > + unsigned long size = 0; > int zid; > > - if (!mem_cgroup_disabled()) > - lru_size = lruvec_page_state_local(lruvec, NR_LRU_BASE + lru); > - else > - lru_size = node_page_state(lruvec_pgdat(lruvec), NR_LRU_BASE + lru); > - > - for (zid = zone_idx + 1; zid < MAX_NR_ZONES; zid++) { > + for (zid = 0; zid <= zone_idx; zid++) { > struct zone *zone = &lruvec_pgdat(lruvec)->node_zones[zid]; > - unsigned long size; > > if (!managed_zone(zone)) > continue; > > if (!mem_cgroup_disabled()) > - size = mem_cgroup_get_zone_lru_size(lruvec, lru, zid); > + size += mem_cgroup_get_zone_lru_size(lruvec, lru, zid); > else > - size = zone_page_state(&lruvec_pgdat(lruvec)->node_zones[zid], > - NR_ZONE_LRU_BASE + lru); > - lru_size -= min(size, lru_size); > + size += zone_page_state(zone, NR_ZONE_LRU_BASE + lru); > } > - > - return lru_size; > + return size; > > } > > -- > 2.21.0 >