Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3372860ybc; Thu, 21 Nov 2019 07:24:57 -0800 (PST) X-Google-Smtp-Source: APXvYqy8ffdzBqa2uaPuMEbS2k73jRjb2hnmGdSu0Sl1IrrPSSkl5Is8zx5xuUAnxUV5MH7iDIHn X-Received: by 2002:a5d:4e89:: with SMTP id e9mr12219187wru.342.1574349897146; Thu, 21 Nov 2019 07:24:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574349897; cv=none; d=google.com; s=arc-20160816; b=UC0tOUf2ZWrgzove6JJjsrObPgV48zQN0npOOl++hgXjQsq78AoHY1sSJGbQTXDOpj OmeKw496hFsmqV0F4fCyqWrHci+pkHs/Q51YG1LwxoF289NFDVGUfQdWE+E3kEo5X/s/ cWCORYV64Iq8GzHooGv2S75hjN8g9fWHhW1n2eP2qzp/fCW+AupfJz15OneC7XWu37sF mm2e0MpmqZsx0zu2FuvPZyaCb2GGyPrusqkY3cDVw1RaRJYRrjOEJvpb/I9YklQ6YdLY vK44DKiSvQAJ/wSQ86HGp1veG6H0bY6Fd7q2kuXE1y6JBe97yd53s1nbcdAAd3MJyefS TFug== 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=cA79heVhzbN56s7O56dDLzv1F5FGQmhR+1Db0CRj8Vc=; b=OOisQc/KYidAKf50Ao/tO2ipl8HS76JALoHmw/fQRWh8CqHpUCicpDvpR3D57skn1L HuK+Zf37DMxHDXv3ivKDImzyV/Y6GNuWIl0geDjXWifPeCOhYqnLmGXnY8tJsi7aH9/x 38cR8XmhgQaeTuA6ExLvjiBGC7vHDRnV2KAs9cXE8GYkWfWG4Cu8cFOC+Sv100Muz737 FRNrlF5CwL8rXPrwAQ1w82/GerMWZ2vHxvHcjCCO7i8QESWZGy76Bobuv84y6rDg7Eq8 xDUgN2YXOcfrFn6k5TcoNYvX8cTbj5HdXl0QBAVXcK1JogEtsRc8LEKQ0ThW6sQn7QVs Fvzw== 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 c12si2410443eda.402.2019.11.21.07.24.31; Thu, 21 Nov 2019 07:24:57 -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 S1727121AbfKUPU1 (ORCPT + 99 others); Thu, 21 Nov 2019 10:20:27 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:50781 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727113AbfKUPU1 (ORCPT ); Thu, 21 Nov 2019 10:20:27 -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 E922A1C000F; Thu, 21 Nov 2019 15:20: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 05/19] mm, slab: use for_each_node in fallback_alloc() Date: Thu, 21 Nov 2019 23:17:57 +0800 Message-Id: <20191121151811.49742-6-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 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 --- 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