In fallback_alloc(), 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/slab.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mm/slab.c b/mm/slab.c index b9a1353cf2ab..b94c06934459 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -3103,12 +3103,11 @@ static void *alternate_node_alloc(struct kmem_cache *cachep, gfp_t flags) */ static void *fallback_alloc(struct kmem_cache *cache, gfp_t flags) { - struct nodelist *nodelist; - struct nlist_traverser t; - struct zone *zone; enum zone_type high_zoneidx = gfp_zone(flags); void *obj = NULL; struct page *page; + struct nodelist *nodelist; + struct nlist_traverser t; int nid; unsigned int cpuset_mems_cookie; @@ -3124,10 +3123,8 @@ static void *fallback_alloc(struct kmem_cache *cache, gfp_t flags) * Look through allowed nodes for objects available * from existing per node queues. */ - for_each_zone_nlist(zone, &t, nodelist, high_zoneidx) { - nid = zone_to_nid(zone); - - if (cpuset_zone_allowed(zone, flags) && + for_each_node_nlist(nid, &t, nodelist, high_zoneidx) { + if (cpuset_node_allowed(nid, flags) && get_node(cache, nid) && get_node(cache, nid)->free_objects) { obj = ____cache_alloc_node(cache, -- 2.23.0