From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E30BC432C3 for ; Fri, 22 Nov 2019 17:45:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F17B42068F for ; Fri, 22 Nov 2019 17:45:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F17B42068F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.page Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 856206B0520; Fri, 22 Nov 2019 12:45:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 807DB6B0521; Fri, 22 Nov 2019 12:45:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CF5F6B0522; Fri, 22 Nov 2019 12:45:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0242.hostedemail.com [216.40.44.242]) by kanga.kvack.org (Postfix) with ESMTP id 56D1B6B0520 for ; Fri, 22 Nov 2019 12:45:19 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 0D0F3180AD822 for ; Fri, 22 Nov 2019 17:45:19 +0000 (UTC) X-FDA: 76184639958.10.frogs49_6890650e0643c X-HE-Tag: frogs49_6890650e0643c X-Filterd-Recvd-Size: 4370 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Nov 2019 17:45:18 +0000 (UTC) X-Originating-IP: 153.3.140.100 Received: from localhost (unknown [153.3.140.100]) (Authenticated sender: fly@kernel.page) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id D0AF440004; Fri, 22 Nov 2019 17:45:04 +0000 (UTC) Date: Sat, 23 Nov 2019 01:44:51 +0800 From: Pengfei Li To: Qian Cai Cc: "lixinhai.lxh@gmail.com\" , akpm , mgorman , Michal Hocko , Vlastimil Babka , cl , "@kvack.org, iamjoonsoo.kim@kvack.org, " , guro , "@kvack.org, linux-kernel@vger.kernel.org, " , "@kvack.org, linux-mm@kvack.org, " , fly@kernel.page"@kvack.org Subject: Re: [RFC v1 00/19] Modify zonelist to nodelist v1 Message-ID: <20191123014451.31197372.fly@kernel.page> In-Reply-To: <1574438002.9585.24.camel@lca.pw> References: <20191121151811.49742-1-fly@kernel.page> <2019112215245905276118@gmail.com> <20191122232847.3ad94414.fly@kernel.page> <1574438002.9585.24.camel@lca.pw> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.123744, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, 22 Nov 2019 10:53:22 -0500 Qian Cai wrote: > On Fri, 2019-11-22 at 23:28 +0800, Pengfei Li wrote: > > On Fri, 22 Nov 2019 15:25:00 +0800 > > "lixinhai.lxh@gmail.com" wrote: > >=20 > > > On 2019-11-21=C2=A0at 23:17=C2=A0Pengfei Li=C2=A0wrote: > > > > Motivation > > > > ---------- > > > > Currently if we want to iterate through all the nodes we have to > > > > traverse all the zones from the zonelist. > > > >=20 > > > > So in order to reduce the number of loops required to traverse > > > > node, this series of patches modified the zonelist to nodelist. > > > >=20 > > > > Two new macros have been introduced: > > > > 1) for_each_node_nlist > > > > 2) for_each_node_nlist_nodemask > > > >=20 > > > >=20 > > > > 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. > > > >=20 > > >=20 > > > It looks to me that we don't really have system which has N nodes > > > and each node with=C2=A0M zones in its address range.=C2=A0 > > > 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. > > >=20 > >=20 > > Thanks for your comments. > >=20 > > In the case you said, the number of loops required to traverse all > > nodes is similar to traversing all zones. > >=20 > > I have two main reasons to explain that this series of patches is > > beneficial. > >=20 > > 1. When node has more than one zone, it will take fewer cycles to > > traverse all nodes. (for example, ZONE_MOVABLE?) >=20 > ZONE_MOVABLE is broken for ages (non-movable allocations are there > all the time last time I tried) which indicates there is very few > people care about it, so it is rather weak to use that as a > justification for the churns it might cause. >=20 Thanks for your comments. Yes, if node has only NORMAL ZONE, then the zonelist is actually a nodelist. This series of patches really only benefits nodes with more than one zone. > >=20 > > 2. Using zonelist to traverse all nodes is inefficient, pgdat must > > be obtained indirectly via zone->zone_pgdat, and additional > > judgment must be made. > >=20 > > E.g > > 1) Using zonelist to traverse all nodes > >=20 > > last_pgdat =3D NULL;=09 > > for_each_zone_zonelist(zone, xxx) { > > pgdat =3D zone->zone_pgdat; > > if (pgdat =3D=3D last_pgdat) > > continue; > >=20 > > last_pgdat =3D pgdat; > > do_something(pgdat); > > } > >=20 > > 2) Using nodelist to traverse all nodes > >=20 > > for_each_node_nodelist(node, xxx) { > > do_something(NODE_INFO(node)); > > } > >=20 --=20 Pengfei