Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1694569

Re: [PATCH 6/9] mm, page_alloc: simplify zonelist initialization

From Vlastimil Babka <vbabka@suse.cz>
Newsgroups linux.kernel
Subject Re: [PATCH 6/9] mm, page_alloc: simplify zonelist initialization
Date 2017-07-24 11:30 +0200
Message-ID <u6HQB-2Si-5@gated-at.bofh.it> (permalink)
References <u5HpD-62U-3@gated-at.bofh.it> <u5HpE-62U-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 07/21/2017 04:39 PM, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> build_zonelists gradually builds zonelists from the nearest to the most
> distant node. As we do not know how many populated zones we will have in
> each node we rely on the _zoneref to terminate initialized part of the
> zonelist by a NULL zone. While this is functionally correct it is quite
> suboptimal because we cannot allow updaters to race with zonelists
> users because they could see an empty zonelist and fail the allocation
> or hit the OOM killer in the worst case.
> 
> We can do much better, though. We can store the node ordering into an
> already existing node_order array and then give this array to
> build_zonelists_in_node_order and do the whole initialization at once.
> zonelists consumers still might see halfway initialized state but that
> should be much more tolerateable because the list will not be empty and
> they would either see some zone twice or skip over some zone(s) in the
> worst case which shouldn't lead to immediate failures.
> 
> While at it let's simplify build_zonelists_node which is rather
> confusing now. It gets an index into the zoneref array and returns
> the updated index for the next iteration. Let's rename the function
> to build_zonerefs_node to better reflect its purpose and give it
> zoneref array to update. The function doesn't the index anymore. It
> just returns the number of added zones so that the caller can advance
> the zonered array start for the next update.
> 
> This patch alone doesn't introduce any functional change yet, though, it
> is merely a preparatory work for later changes.
> 
> Changes since v1
> - build_zonelists_node -> build_zonerefs_node and operate directly on
>   zonerefs array rather than play tricks with index into the array.
> - give build_zonelists_in_node_order nr_nodes to not iterate over all
>   MAX_NUMNODES as per Mel
> 
> Signed-off-by: Michal Hocko <mhocko@suse.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH -v1 0/9] cleanup zonelists initialization Michal Hocko <mhocko@kernel.org> - 2017-07-21 16:50 +0200
  [PATCH 6/9] mm, page_alloc: simplify zonelist initialization Michal Hocko <mhocko@kernel.org> - 2017-07-21 16:50 +0200
    Re: [PATCH 6/9] mm, page_alloc: simplify zonelist initialization Vlastimil Babka <vbabka@suse.cz> - 2017-07-24 11:30 +0200
  [PATCH 1/9] mm, page_alloc: rip out ZONELIST_ORDER_ZONE Michal Hocko <mhocko@kernel.org> - 2017-07-21 16:50 +0200
  [PATCH 5/9] mm, memory_hotplug: remove explicit build_all_zonelists from try_online_node Michal Hocko <mhocko@kernel.org> - 2017-07-21 16:50 +0200
  [PATCH 7/9] mm, page_alloc: remove stop_machine from build_all_zonelists Michal Hocko <mhocko@kernel.org> - 2017-07-21 16:50 +0200
  [PATCH 4/9] mm, memory_hotplug: drop zone from build_all_zonelists Michal Hocko <mhocko@kernel.org> - 2017-07-21 16:50 +0200
  [PATCH 9/9] mm, sparse, page_ext: drop ugly N_HIGH_MEMORY branches for allocations Michal Hocko <mhocko@kernel.org> - 2017-07-21 16:50 +0200
  [PATCH 3/9] mm, page_alloc: do not set_cpu_numa_mem on empty nodes initialization Michal Hocko <mhocko@kernel.org> - 2017-07-21 16:50 +0200

csiph-web