Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3372832ybc; Thu, 21 Nov 2019 07:24:55 -0800 (PST) X-Google-Smtp-Source: APXvYqxmnUMC8IpcoQ6MSkBRqmwdIDPI1NUVq8fvWsBwo0ORh8H+7QNRdjr+0TGgiaVaCwawC5gb X-Received: by 2002:adf:f1cb:: with SMTP id z11mr3411972wro.375.1574349895482; Thu, 21 Nov 2019 07:24:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574349895; cv=none; d=google.com; s=arc-20160816; b=WMLeIFG5P1vOPEaB5hb6ID2IkaOiHYQ6iE16Ml43bFVmfssbUQ72OmId2KT5FB3yAW 8KWQy2ZdiY2OlS2iBZO4dO9PjTe0u+ww2Bh2YdbK5YGJXIYowSIbKV/a6LCTkIFyp1Zx l/h4Kh+8qYl0qQVuGDVeHk/lnUXabhVqrfjGt8zg47JmEJWlP2ikh8/8fFq40ss12zmV fPbVzJLT36WBnrnFXwXWJhYZpDtgCQiTUclz3Sj2NUdo/zUXWk+qf2JalKAjFL8OKhj2 XZIB1xpkPwO/uC7LX3dLItqDbqf1wzU+VUssWXJ7i4SEr1gbfDac4JqoonFSLhsvJT3G gjbw== 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; bh=kSTn64HYDMz55psANF4BhecoKcQPpobxku7TwhSdA1Y=; b=FYGcsaDN3RBJ21TIps4eK6NplT/0rCUErSti1ycPeDLXjP37/AxXdRV/qTBmRHHCzU cWp4i9TEj6xRNv7xlYfekcv4mjRW2lJQ0jo4+nHC3MHeJFEUux6VSwc5jVnC5xTFdrok YuPdA9b/W6pquSD9cIlMGPxgfiMvLWSd4EJw5hCfmo9NJL5UlRWCQ21pKns7OsMk71yg Xbn7uZFadtKWXQL+f3MIqWmkdB1pzFflxd61HSYHmN8uJCIHGqINhjgBFDeItMpgYgWQ XYfO+wVTEj1UcfiAEZaeQgzjCcnFg5l0KwZX2ycb/FTGksx0iiHN6SFV2BeX412Ir3En o/NA== 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 f2si2306322eda.339.2019.11.21.07.24.31; Thu, 21 Nov 2019 07:24:55 -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; 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 S1727133AbfKUPUf (ORCPT + 99 others); Thu, 21 Nov 2019 10:20:35 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:45711 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726541AbfKUPUf (ORCPT ); Thu, 21 Nov 2019 10:20:35 -0500 X-Originating-IP: 153.3.140.100 Received: from localhost.localdomain.localdomain (unknown [153.3.140.100]) (Authenticated sender: fly@kernel.page) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 02CAE1C001E; Thu, 21 Nov 2019 15:20:26 +0000 (UTC) From: Pengfei Li To: akpm@linux-foundation.org Cc: mgorman@techsingularity.net, mhocko@kernel.org, vbabka@suse.cz, cl@linux.com, iamjoonsoo.kim@lge.com, guro@fb.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Pengfei Li Subject: [RFC v1 06/19] mm, vmscan: use for_each_node in do_try_to_free_pages() Date: Thu, 21 Nov 2019 23:17:58 +0800 Message-Id: <20191121151811.49742-7-fly@kernel.page> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191121151811.49742-1-fly@kernel.page> References: <20191121151811.49742-1-fly@kernel.page> 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 In do_try_to_free_pages(), we want to traverse node instead of zone, so use for_each_node instead of for_each_zone. Signed-off-by: Pengfei Li --- mm/vmscan.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index a3ad433c8ff4..159a2aaa8db1 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3033,9 +3033,9 @@ static unsigned long do_try_to_free_pages(struct nodelist *nodelist, struct scan_control *sc) { int initial_priority = sc->priority; - pg_data_t *last_pgdat; + pg_data_t *pgdat; struct nlist_traverser t; - struct zone *zone; + int node; retry: delayacct_freepages_start(); @@ -3062,20 +3062,17 @@ static unsigned long do_try_to_free_pages(struct nodelist *nodelist, sc->may_writepage = 1; } while (--sc->priority >= 0); - last_pgdat = NULL; - for_each_zone_nlist_nodemask(zone, &t, nodelist, sc->reclaim_idx, - sc->nodemask) { - if (zone->zone_pgdat == last_pgdat) - continue; - last_pgdat = zone->zone_pgdat; + for_each_node_nlist_nodemask(node, &t, nodelist, + sc->reclaim_idx, sc->nodemask) { + pgdat = NODE_DATA(node); - snapshot_refaults(sc->target_mem_cgroup, zone->zone_pgdat); + snapshot_refaults(sc->target_mem_cgroup, pgdat); if (cgroup_reclaim(sc)) { struct lruvec *lruvec; lruvec = mem_cgroup_lruvec(sc->target_mem_cgroup, - zone->zone_pgdat); + pgdat); clear_bit(LRUVEC_CONGESTED, &lruvec->flags); } } -- 2.23.0