Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp435267ybc; Fri, 22 Nov 2019 07:32:54 -0800 (PST) X-Google-Smtp-Source: APXvYqwq7arUIkufS+whyZYrF5biTzO7FUb4CM/7C58CGkUJbq72pyrjPhZ5mlT3yZ4RFa0DpAYi X-Received: by 2002:aa7:d5ce:: with SMTP id d14mr1805737eds.64.1574436774502; Fri, 22 Nov 2019 07:32:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574436774; cv=none; d=google.com; s=arc-20160816; b=cAsgt3ftJ+j+BSjlrdhGZJokXBVve7RyzDv8hANZl5awSoHClB1aTaUDzrEOK+gkJ1 sq8nLWXSBmIsKak+ENPKcR/KQn1/t4nq3fw9c6duaeqDBuhkfusbs2F2vFih5X2UtmJv QpuUbxCK0Wq02IRcrppsGTtvKuIiRtnVCftEdWubhyghCLQGKwAKLTmtuebg0vs4xgMs 0elbEW15szu0QaUe1TFEkRKp2czMS9tbqL4f432agskXBqWL/MNRRl8HWDO0+69cdtBd noa0PophfOAociJKulvpib+vOFGtrNIH/G/tJhssennQ/U7k/R0XUKDsqJRld9ZlQPDX sYEA== 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:subject:cc:to:from:date; bh=OcHF1IMao1IV278fb9iNYIcNOyTa6Cn7SaQI70IWAWY=; b=O82apwLj2dqzelPJOjAAf1ugpeaSRMOagBSVSB8k4h3g18t47j+KSAP3sZmA6RMPnh r9VMPQZFr6i0aEe6jF6M3CVtyajebpFKWGSmx/OyqzhrlZk+SW3pvwXGlbA33RERN2BY eFO/833WaGsbuEQ1fEx5Cz+tqLYJ7mgOXpmLw01b9u7MqY8lWHDIPaM5/aN/pX8qFlcE y9k7dHKixeDLtKimcnJ67qzwK1nNMhxV6Q3FxnOYFTWDylKNSkj5GLWtvrBd3S0AxfVU wkNNMFdTOZIi0QHt87QsTA5ukb85+ZmmEe4OtHx16bbMW5jz2ZPThFl71caByouZ2nlb N28w== 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 p17si4855437edm.269.2019.11.22.07.32.29; Fri, 22 Nov 2019 07:32: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 S1727047AbfKVP3U convert rfc822-to-8bit (ORCPT + 99 others); Fri, 22 Nov 2019 10:29:20 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:40691 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726100AbfKVP3U (ORCPT ); Fri, 22 Nov 2019 10:29:20 -0500 X-Originating-IP: 153.3.140.100 Received: from localhost (unknown [153.3.140.100]) (Authenticated sender: fly@kernel.page) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 7FDC91C001A; Fri, 22 Nov 2019 15:29:05 +0000 (UTC) Date: Fri, 22 Nov 2019 23:28:47 +0800 From: Pengfei Li To: "lixinhai.lxh@gmail.com" Cc: akpm , mgorman , "Michal Hocko" , "Vlastimil Babka" , cl , "iamjoonsoo.kim" , guro , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , fly@kernel.page Subject: Re: [RFC v1 00/19] Modify zonelist to nodelist v1 Message-ID: <20191122232847.3ad94414.fly@kernel.page> In-Reply-To: <2019112215245905276118@gmail.com> References: <20191121151811.49742-1-fly@kernel.page> <2019112215245905276118@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Nov 2019 15:25:00 +0800 "lixinhai.lxh@gmail.com" wrote: > On 2019-11-21 at 23:17 Pengfei Li wrote: > >Motivation > >---------- > >Currently if we want to iterate through all the nodes we have to > >traverse all the zones from the zonelist. > > > >So in order to reduce the number of loops required to traverse node, > >this series of patches modified the zonelist to nodelist. > > > >Two new macros have been introduced: > >1) for_each_node_nlist > >2) for_each_node_nlist_nodemask > > > > > >Benefit > >------- > >1. For a NUMA system with N nodes, each node has M zones, the number > >   of loops is reduced from N*M times to N times when traversing > >node. > > > > It looks to me that we don't really have system which has N nodes and > each node with M zones in its address range.  > We may have systems which has several nodes, but only the first node > has all zone types, other nodes only have NORMAL zone. (Evenly > distribute the !NORMAL zones on all nodes is not reasonable, as those > zones have limited size) > So iterate over zones to reach nodes should at N level, not M*N level. > Thanks for your comments. In the case you said, the number of loops required to traverse all nodes is similar to traversing all zones. I have two main reasons to explain that this series of patches is beneficial. 1. When node has more than one zone, it will take fewer cycles to traverse all nodes. (for example, ZONE_MOVABLE?) 2. Using zonelist to traverse all nodes is inefficient, pgdat must be obtained indirectly via zone->zone_pgdat, and additional judgment must be made. E.g 1) Using zonelist to traverse all nodes last_pgdat = NULL; for_each_zone_zonelist(zone, xxx) { pgdat = zone->zone_pgdat; if (pgdat == last_pgdat) continue; last_pgdat = pgdat; do_something(pgdat); } 2) Using nodelist to traverse all nodes for_each_node_nodelist(node, xxx) { do_something(NODE_INFO(node)); }