On Thu, Aug 12, 2021 at 06:52:21PM +0530, Aneesh Kumar K.V wrote:
> The associativity details of the newly added resourced are collected from
> the hypervisor via "ibm,configure-connector" rtas call. Update the numa
> distance details of the newly added numa node after the above call.
> 
> Instead of updating NUMA distance every time we lookup a node id
> from the associativity property, add helpers that can be used
> during boot which does this only once. Also remove the distance
> update from node id lookup helpers.
> 
> Currently, we duplicate parsing code for ibm,associativity and
> ibm,associativity-lookup-arrays in the kernel. The associativity array 
> provided
> by these device tree properties are very similar and hence can use
> a helper to parse the node id and numa distance details.
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.ku...@linux.ibm.com>

Reviewed-by: David Gibson <da...@gibson.dropbear.id.au>

There are a handful of nits it would be nice to clean up as followups, though:

[snip]
> +static int get_nid_and_numa_distance(struct drmem_lmb *lmb)
> +{
> +     struct assoc_arrays aa = { .arrays = NULL };
> +     int default_nid = NUMA_NO_NODE;

I don't think there's any point to the 'default_nid' variable.

> +     int nid = default_nid;
> +     int rc, index;
> +
> +     if ((primary_domain_index < 0) || !numa_enabled)
> +             return default_nid;
> +
> +     rc = of_get_assoc_arrays(&aa);
> +     if (rc)
> +             return default_nid;
> +
> +     if (primary_domain_index <= aa.array_sz &&

You don't need this test any more - it's included in __associativity_to_nid().

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature

Reply via email to