Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp460091ybc; Fri, 22 Nov 2019 07:55:11 -0800 (PST) X-Google-Smtp-Source: APXvYqz3fG0RgvwMeTYHooCsKIdldQxuVaYgYzXvixz9KotblWv23PA9aD11+yPGixI14C97Dj0L X-Received: by 2002:a50:9f65:: with SMTP id b92mr1926612edf.63.1574438111063; Fri, 22 Nov 2019 07:55:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574438111; cv=none; d=google.com; s=arc-20160816; b=sXZP++GS5xJd+9ZQMpkhQFg9PNi0jMQA3oiNX4L+J0FPFcYlHNLk35s1kxw0llMFhK cyhorHA8M6k5m+ax9ENBWGjfOOOeHcxUkF1Kp/CsUlluHtsrpSmjMwGkxu+KL2RA9FYH Lu3VPTMtKRkPVK3CXgy6LirVlZKH0JscipByJP9O3eZB0TUnK+E5JGbed3WROe5kHEkv wtOGkIO6VwI2if57Cn8FrTlen0yP/GO9tqmx5d6fWlkgDnCZG7Cw4gspNX/vl+DLFVY6 c+ynwaNaP2OngqKRu7llDEpq58OV6+rgD1XtpobyJu7sxKgviAjxobM9heEU2pbkNfGb GClQ== 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:date:cc:to:from:subject:message-id :dkim-signature; bh=GkZzui3E9R3KSyvipQDNYjoE7WRU9+0cmj9xVI1nge4=; b=Kj17aq27Se7yuSUWiF1PbhY+/NQKlwtitpvmz4YVbUGnPf9VJ7kgY7N+AiaCHXTBD9 rU54uaR7XYWJBqNto5BJ1JWSKJCawHeTB6mOR+OTkv7WRkX9JXygyZjDfg7iH5fN4bra CpRI/8HKRLjEzJqxKL2eDNRS4rs6nYHdOwjEo5eZIpbl3sch8ffgLPSgmcLUcwlELSd1 2AkexY12Nl7SC+YKdxjs0P28XNWVnLst2FuQmZY4EuU2bx7iWC4srVC0xnlM2sk/9NR9 HRjhTEWrRubzdXS/ovFTYCQPNTmgtyJdnXazyvoAKtimBllh5NzOSjBpd0Lqa2HDLzjI GRVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=bMOmi7yg; 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 y9si3360047eju.209.2019.11.22.07.54.45; Fri, 22 Nov 2019 07:55:11 -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; dkim=pass header.i=@lca.pw header.s=google header.b=bMOmi7yg; 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 S1726655AbfKVPx0 (ORCPT + 99 others); Fri, 22 Nov 2019 10:53:26 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:39057 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726546AbfKVPx0 (ORCPT ); Fri, 22 Nov 2019 10:53:26 -0500 Received: by mail-qt1-f193.google.com with SMTP id t8so8330869qtc.6 for ; Fri, 22 Nov 2019 07:53:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=GkZzui3E9R3KSyvipQDNYjoE7WRU9+0cmj9xVI1nge4=; b=bMOmi7ygSWmpbSxd0KtFQM18DSKQIWiDhQXCEWRVzL4ABA+tQ4p/noNyDwbyeZ7pYW /nyBWQS5gqF+TouRNoVIdFOyqMlsbpaGqnNdJJ4FeNta2eJdhG6vEAZ3dLikvY11PpGG My9zL0y6GgxmYbylX/Dfkqr+e1adRx++jyTSsP1J97qhavhjUNFqq+uynHc6eCuOLoxI /sEgg+vSw6PShFw89sKe8mZ3zfocz/Bb3qxBX1whZwTBAfc6aRRs8xlO+lt8KC6z8l1o GrIBblPQrr+pqA9AaTdu0oDn1rF6es5c/+TKWiT77Cvj+O0hmiYlClcTnAILhfe/eNq+ QPtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=GkZzui3E9R3KSyvipQDNYjoE7WRU9+0cmj9xVI1nge4=; b=O2ltt1FjfePZrJ0bM5/nk6pq3YjMsbqWj+NNhFBg6JSM2p7YrKS/RbU3SzFGzjQ4W8 NYFK5nANQF+m6HF4yYy9m2gFniA20Um44tMSgCVRy23ve24d/tka5ArRf5p3DPj96Cib IvPntiGNqFF7pu9U7gfV4RTLZsvUbO5wwQpbjTop92LMY84SbOLDH1WwkULmjxXvB11w +O987CLQozxWX4XQs0YiiaFQvzw1HqnDL8bpd27LYjxnb8slN/MIUGNBUlkAKLlj1FPF PIH5RYdsJ0Q5I0zF4UtV/2G6uDUfPsv8c8Ra9wHvqhNPc3ArggLJ1w7VZ5Qd+qefXh2s aMBg== X-Gm-Message-State: APjAAAUfu8rgQNWNcmQWnX6IpBWPxZr0z8N/W0pEMfxk5lTMMImabNGq 6oHsxrCy9S+A1MoD4tulqGCBVg== X-Received: by 2002:ac8:2f54:: with SMTP id k20mr879767qta.235.1574438005031; Fri, 22 Nov 2019 07:53:25 -0800 (PST) Received: from dhcp-41-57.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id d13sm3609264qta.67.2019.11.22.07.53.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Nov 2019 07:53:24 -0800 (PST) Message-ID: <1574438002.9585.24.camel@lca.pw> Subject: Re: [RFC v1 00/19] Modify zonelist to nodelist v1 From: Qian Cai To: Pengfei Li , "lixinhai.lxh@gmail.com" Cc: akpm , mgorman , Michal Hocko , Vlastimil Babka , cl , "iamjoonsoo.kim" , guro , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" Date: Fri, 22 Nov 2019 10:53:22 -0500 In-Reply-To: <20191122232847.3ad94414.fly@kernel.page> References: <20191121151811.49742-1-fly@kernel.page> <2019112215245905276118@gmail.com> <20191122232847.3ad94414.fly@kernel.page> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6 (3.22.6-10.el7) 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 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: > > > 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?) 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. > > 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)); > } >