In mempolicy_slab_node(), we want to access first node instead of first zone, so use first_node_nlist instead of first_zone_nlist. Signed-off-by: Pengfei Li <fly@xxxxxxxxxxx> --- mm/mempolicy.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index b1df19d42047..66184add1627 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1855,8 +1855,10 @@ static unsigned interleave_nodes(struct mempolicy *policy) */ unsigned int mempolicy_slab_node(void) { - struct mempolicy *policy; int node = numa_mem_id(); + struct mempolicy *policy; + struct nodelist *nodelist; + int first_node; if (in_interrupt()) return node; @@ -1876,18 +1878,16 @@ unsigned int mempolicy_slab_node(void) return interleave_nodes(policy); case MPOL_BIND: { - struct zone *zone; - /* * Follow bind policy behavior and start allocation at the * first node. */ - struct nodelist *nodelist; - enum zone_type highest_zoneidx = gfp_zone(GFP_KERNEL); - nodelist = &NODE_DATA(node)->node_nodelists[NODELIST_FALLBACK]; - zone = first_zone_nlist_nodemask(nodelist, highest_zoneidx, - &policy->v.nodes); - return zone ? zone_to_nid(zone) : node; + nodelist = node_nodelist(node, GFP_KERNEL); + + first_node = first_node_nlist_nodemask(nodelist, + gfp_zone(GFP_KERNEL), &policy->v.nodes); + + return (first_node != NUMA_NO_NODE) ? first_node : node; } default: -- 2.23.0