[RFC v1 06/19] mm, vmscan: use for_each_node in do_try_to_free_pages()

From: Pengfei Li
Date: Thu Nov 21 2019 - 10:20:36 EST


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 <fly@xxxxxxxxxxx>
---
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