Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3371225ybc; Thu, 21 Nov 2019 07:23:41 -0800 (PST) X-Google-Smtp-Source: APXvYqyujtPt+KDuWaDUGB7e7yRoZkWWVW9RePynUjhLeYCRALhpL++GYCU+qMmRwL1G0rLdTKe8 X-Received: by 2002:a05:651c:1a1:: with SMTP id c1mr8196334ljn.23.1574349820880; Thu, 21 Nov 2019 07:23:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574349820; cv=none; d=google.com; s=arc-20160816; b=xtM9/VTekE7gsPs9tBI2iqyx7/FluXO7ewPWFASwPqw9GShWEkc1aVazuIJ+aJQ68q ymrl6vDiCROCgpEmNi9dr+6rQ6apuo33iVKaF+mEFJCvJBz/fUDj1l67aKIN1jHQZHd5 ynP79Mx/kyMRWAMkcI/tNrhVzPTqLZIYlc/mMRk3uyGaflt+i3YUVmyqHUaipzjfdjxc 9IsB+gXwEU9IMYdB/PIcKABuaQXbHsXBZd+st8/l+TEhQhH7qj6ENwX4VDJb3jxW3h1f 6ezDHLwvzcoBFD7I4ZqMM3G6Cik6KVMJYtvFn3hN5GRyZfF+2UPLbB/nXw7iA/ycMwCx XB7w== 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=3TxnTFt5C13kyosDYgXSyDaQXGM3dYLaj27rvORnX7k=; b=gWoaNMGYgA91gBFu3uiZkqIwKlo4bBF717VFqI6+53S6FV5eA0/at0bTrqUT4TwluA E7lgcFkzeADdylSwgw8Z5zFcupWX0eP0g2AFhayvMUiz6fxLOs3avSjDPppTDohC3+Jt 7SWQYg+KqVFcPkoZgeSca3ekxw0AmwZMu8Mb0cPl5xmfFuhcgurvBAM8nNa6fulqmoL7 E7cOhcgZht89qoSsaL36NnQk4NaZ8V7A1Ja5+JcL6xe7eSStja3A5cOKTc6Q1wiTYZtn QFFVYyXV9EbJ2nZ1F9XMzyD9ykQxNgk4N/aagScNVGAz+ZHeguw7gBj544IV5rb2l5/w jxTg== 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 b41si2451532eda.1.2019.11.21.07.23.15; Thu, 21 Nov 2019 07:23:40 -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 S1726920AbfKUPVZ (ORCPT + 99 others); Thu, 21 Nov 2019 10:21:25 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:53999 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726279AbfKUPVY (ORCPT ); Thu, 21 Nov 2019 10:21:24 -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 CFACD1C0014; Thu, 21 Nov 2019 15:21:15 +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 11/19] mm, mempolicy: use first_node in mempolicy_slab_node() Date: Thu, 21 Nov 2019 23:18:03 +0800 Message-Id: <20191121151811.49742-12-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 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 --- 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