Re: [PATCH 2/6] mm/memblock: make full utilization of numa info

From: Dave Hansen
Date: Mon Feb 25 2019 - 10:34:05 EST


On 2/24/19 4:34 AM, Pingfan Liu wrote:
> +/*
> + * build_node_order() relies on cpumask_of_node(), hence arch should
> + * set up cpumask before calling this func.
> + */

Whenever I see comments like this, I wonder what happens if the arch
doesn't do this? Do we just crash in early boot in wonderful new ways?
Or do we get a nice message telling us?

> +void __init memblock_build_node_order(void)
> +{
> + int nid, i;
> + nodemask_t used_mask;
> +
> + node_fallback = memblock_alloc(MAX_NUMNODES * sizeof(int *),
> + sizeof(int *));
> + for_each_online_node(nid) {
> + node_fallback[nid] = memblock_alloc(
> + num_online_nodes() * sizeof(int), sizeof(int));
> + for (i = 0; i < num_online_nodes(); i++)
> + node_fallback[nid][i] = NUMA_NO_NODE;
> + }
> +
> + for_each_online_node(nid) {
> + nodes_clear(used_mask);
> + node_set(nid, used_mask);
> + build_node_order(node_fallback[nid], num_online_nodes(),
> + nid, &used_mask);
> + }
> +}

This doesn't get used until patch 6 as far as I can tell. Was there a
reason to define it here?