linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pengfei Li <fly@kernel.page>
To: Qian Cai <cai@lca.pw>
Cc: "lixinhai.lxh@gmail.com\"  <lixinhai.lxh@gmail.com>,
	akpm  <akpm@linux-foundation.org>,
	mgorman <mgorman@techsingularity.net>,
	Michal  Hocko <mhocko@kernel.org>,
	Vlastimil Babka <vbabka@suse.cz>, cl  <cl@linux.com>,
	"@kvack.org, iamjoonsoo.kim@kvack.org, " <iamjoonsoo.kim@lge.com>,
	guro  <guro@fb.com>,
	"@kvack.org, linux-kernel@vger.kernel.org,
	"  <linux-kernel@vger.kernel.org>,
	"@kvack.org, linux-mm@kvack.org, " <linux-mm@kvack.org>,
	 fly@kernel.page"@kvack.org
Subject: Re: [RFC v1 00/19] Modify zonelist to nodelist v1
Date: Sat, 23 Nov 2019 01:44:51 +0800	[thread overview]
Message-ID: <20191123014451.31197372.fly@kernel.page> (raw)
In-Reply-To: <1574438002.9585.24.camel@lca.pw>

On Fri, 22 Nov 2019 10:53:22 -0500
Qian Cai <cai@lca.pw> 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" <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.
> 

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.

> > 
> > 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));
> > 	}
> > 

-- 
Pengfei


  reply	other threads:[~2019-11-22 17:45 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21 15:17 Pengfei Li
2019-11-21 15:17 ` [RFC v1 01/19] mm, mmzone: modify zonelist to nodelist Pengfei Li
2019-11-21 15:17 ` [RFC v1 02/19] mm, hugetlb: use for_each_node in dequeue_huge_page_nodemask() Pengfei Li
2019-11-21 15:17 ` [RFC v1 03/19] mm, oom_kill: use for_each_node in constrained_alloc() Pengfei Li
2019-11-21 15:17 ` [RFC v1 04/19] mm, slub: use for_each_node in get_any_partial() Pengfei Li
2019-11-21 15:17 ` [RFC v1 05/19] mm, slab: use for_each_node in fallback_alloc() Pengfei Li
2019-11-21 15:17 ` [RFC v1 06/19] mm, vmscan: use for_each_node in do_try_to_free_pages() Pengfei Li
2019-11-21 15:17 ` [RFC v1 07/19] mm, vmscan: use first_node in throttle_direct_reclaim() Pengfei Li
2019-11-21 15:18 ` [RFC v1 08/19] mm, vmscan: pass pgdat to wakeup_kswapd() Pengfei Li
2019-11-21 15:18 ` [RFC v1 09/19] mm, vmscan: use for_each_node in shrink_zones() Pengfei Li
2019-11-21 15:18 ` [RFC v1 10/19] mm, page_alloc: use for_each_node in wake_all_kswapds() Pengfei Li
2019-11-21 15:18 ` [RFC v1 11/19] mm, mempolicy: use first_node in mempolicy_slab_node() Pengfei Li
2019-11-21 15:18 ` [RFC v1 12/19] mm, mempolicy: use first_node in mpol_misplaced() Pengfei Li
2019-11-21 15:18 ` [RFC v1 13/19] mm, page_alloc: use first_node in local_memory_node() Pengfei Li
2019-11-21 15:18 ` [RFC v1 14/19] mm, compaction: rename compaction_zonelist_suitable Pengfei Li
2019-11-21 15:18 ` [RFC v1 15/19] mm, mm_init: rename mminit_verify_zonelist Pengfei Li
2019-11-21 15:18 ` [RFC v1 16/19] mm, page_alloc: cleanup build_zonelists Pengfei Li
2019-11-21 15:18 ` [RFC v1 17/19] mm, memory_hotplug: cleanup online_pages() Pengfei Li
2019-11-21 15:18 ` [RFC v1 18/19] kernel, sysctl: cleanup numa_zonelist_order Pengfei Li
2019-11-21 15:18 ` [RFC v1 19/19] mm, mmzone: cleanup zonelist in comments Pengfei Li
2019-11-21 18:04 ` [RFC v1 00/19] Modify zonelist to nodelist v1 Michal Hocko
2019-11-22 15:05   ` Pengfei Li
2019-11-25  8:40     ` Michal Hocko
2019-11-25 14:46       ` Pengfei Li
2019-11-25 15:46         ` Michal Hocko
2019-11-22  7:25 ` lixinhai.lxh
2019-11-22 10:14   ` David Hildenbrand
2019-11-22 15:28   ` Pengfei Li
2019-11-22 15:53     ` Qian Cai
2019-11-22 17:44       ` Pengfei Li [this message]
2019-11-25  8:39       ` Michal Hocko
2019-11-26 15:30         ` Qian Cai
2019-11-26 15:41           ` Michal Hocko
2019-11-26 19:04             ` Qian Cai
2019-11-27  8:50               ` Michal Hocko
2019-11-22 10:03 ` David Hildenbrand
2019-11-22 15:49   ` Pengfei Li
2019-11-22 15:53     ` Christopher Lameter
2019-11-22 16:06       ` David Hildenbrand
2019-11-22 17:36       ` Pengfei Li
2019-11-22 18:24         ` Christopher Lameter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191123014451.31197372.fly@kernel.page \
    --to=fly@kernel.page \
    --cc="  <linux-kernel@vger.kernel.org>, "@kvack.org \
    --cc=" <iamjoonsoo.kim@lge.com>, guro  <guro@fb.com>, "@kvack.org \
    --cc=" <linux-mm@kvack.org>,  fly@kernel.page"@kvack.org \
    --cc="lixinhai.lxh@gmail.com\"  <lixinhai.lxh@gmail.com>, akpm  <akpm@linux-foundation.org>, mgorman <mgorman@techsingularity.net>, Michal  Hocko <mhocko@kernel.org>, Vlastimil Babka <vbabka@suse.cz>, cl  <cl@linux.com>, "@kvack.org \
    --cc=cai@lca.pw \
    --cc=iamjoonsoo.kim@kvack.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox