Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3369010ybc; Thu, 21 Nov 2019 07:21:54 -0800 (PST) X-Google-Smtp-Source: APXvYqwMl81osqLTqHMxtZwDcxQMvDY525x+3P4N1M3QPVzqvcFk7dbw6yq1/VnByajjqNdxGbQL X-Received: by 2002:a17:906:d293:: with SMTP id ay19mr14457932ejb.146.1574349714261; Thu, 21 Nov 2019 07:21:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574349714; cv=none; d=google.com; s=arc-20160816; b=yjVUs5ZRsNo3l7RK53AhhlNQVHR/nXCE3RVuxjEsKWUasLIpDl2BNJHOxhPO+2xMhg YldgrB/BF09y+oji5zUb9nJ/ycGTma+kY5K2Pm1HHEDDcFicX9Ljgl+COvDb0+Fl6vzE /2XqXR/yUyZCnvg1L8YB/4U+rvaJrVmjHr/85dNW/Yf+3pE2rL/QYHABGewEFxUeY21Y vxwMhqTLqv29KZfY0u+EtQ5dMT+FoRpnC5+ft8WxWHxe3YznrR8DFT5u9ytmOSeQDeCu /xppyF8zHmAuWSg4ka+JzV9zItuXMqr9IZdQvveAsJXTKvv2+qNlOlLHBUbUVWsekBNc kilw== 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=QYalgt2fJuickzQXe7qC3+PK7luPRXQOUrT5pJnTLj8=; b=CsTuRkXKPro/jCf1OqRCZbSLFRz7zLI8+I4zlr5w11pEmDRyHTRPt+YgNhHVg4VABP S1R/K77LWbPDhIG9LXhc6Zz+wNjp0QUhHPU0q3EMUFYvOdr9KDO6ndDsvd9KvlmHdf6a qaHXY2c8eCZVwq0lL1PX5gAG4G8bLyqpA1TvF5EQzN1wqOtfTItDYVSALdhPC1k58LQ1 /bnJZEvPQ0JmtYVAR4yW6HiJ8IISz5+nwJGhSikWNvsLFilq/0sgnvF8rxX4kCVcDISu FjbaNusGmZydimUDYa63Etrig9/wD2aaeN9+H8iB+SvqrMllh+9A73svbNFXbDINTd8C Xukg== 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 o22si2029770ejr.78.2019.11.21.07.21.30; Thu, 21 Nov 2019 07:21:54 -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 S1727008AbfKUPUJ (ORCPT + 99 others); Thu, 21 Nov 2019 10:20:09 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:56381 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726541AbfKUPUJ (ORCPT ); Thu, 21 Nov 2019 10:20:09 -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 736C51C001F; Thu, 21 Nov 2019 15:19:59 +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 03/19] mm, oom_kill: use for_each_node in constrained_alloc() Date: Thu, 21 Nov 2019 23:17:55 +0800 Message-Id: <20191121151811.49742-4-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 constrained_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/oom_kill.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index f44c79db0cd6..db509d5e4db3 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -254,7 +254,6 @@ static enum oom_constraint constrained_alloc(struct oom_control *oc) enum zone_type high_zoneidx = gfp_zone(oc->gfp_mask); bool cpuset_limited = false; struct nlist_traverser t; - struct zone *zone; int nid; if (is_memcg_oom(oc)) { @@ -292,10 +291,13 @@ static enum oom_constraint constrained_alloc(struct oom_control *oc) } /* Check this allocation failure is caused by cpuset's wall function */ - for_each_zone_nlist_nodemask(zone, &t, oc->nodelist, - high_zoneidx, oc->nodemask) - if (!cpuset_zone_allowed(zone, oc->gfp_mask)) + for_each_node_nlist_nodemask(nid, &t, oc->nodelist, + high_zoneidx, oc->nodemask) { + if (!cpuset_node_allowed(nid, oc->gfp_mask)) { cpuset_limited = true; + break; + } + } if (cpuset_limited) { oc->totalpages = total_swap_pages; -- 2.23.0