[RFC v1 02/19] mm, hugetlb: use for_each_node in dequeue_huge_page_nodemask()

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


In dequeue_huge_page_nodemask(), 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/hugetlb.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 2e55ec5dc84d..287b90c7ab36 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -850,25 +850,18 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask,
unsigned int cpuset_mems_cookie;
struct nodelist *nodelist;
struct nlist_traverser t;
- struct zone *zone;
- int node = NUMA_NO_NODE;
+ int node;

nodelist = node_nodelist(nid, gfp_mask);

retry_cpuset:
cpuset_mems_cookie = read_mems_allowed_begin();
- for_each_zone_nlist_nodemask(zone, &t, nodelist, gfp_zone(gfp_mask), nmask) {
+ for_each_node_nlist_nodemask(node, &t, nodelist,
+ gfp_zone(gfp_mask), nmask) {
struct page *page;

- if (!cpuset_zone_allowed(zone, gfp_mask))
- continue;
- /*
- * no need to ask again on the same node. Pool is node rather than
- * zone aware
- */
- if (zone_to_nid(zone) == node)
+ if (!cpuset_node_allowed(node, gfp_mask))
continue;
- node = zone_to_nid(zone);

page = dequeue_huge_page_node_exact(h, node);
if (page)
--
2.23.0