Re: [PATCHv2 2/3] mm/numa: build zonelist when alloc for device on offline node

From: Michal Hocko
Date: Thu Dec 20 2018 - 06:35:55 EST


On Thu 20-12-18 17:50:38, Pingfan Liu wrote:
[...]
> @@ -453,7 +456,12 @@ static inline int gfp_zonelist(gfp_t flags)
> */
> static inline struct zonelist *node_zonelist(int nid, gfp_t flags)
> {
> - return NODE_DATA(nid)->node_zonelists + gfp_zonelist(flags);
> + if (unlikely(!possible_zonelists[nid])) {
> + WARN_ONCE(1, "alloc from offline node: %d\n", nid);
> + if (unlikely(build_fallback_zonelists(nid)))
> + nid = first_online_node;
> + }
> + return possible_zonelists[nid] + gfp_zonelist(flags);
> }

No, please don't do this. We do not want to make things work magically
and we definitely do not want to put something like that into the hot
path. We definitely need zonelists to be build transparently for all
possible nodes during the init time.
--
Michal Hocko
SUSE Labs