Re: [PATCH v2] x86/platform/uv: UV support for sub-NUMA clustering

From: Ingo Molnar
Date: Wed Jan 25 2023 - 06:29:25 EST



* Steve Wahl <steve.wahl@xxxxxxx> wrote:

> +static int __init alloc_conv_table(int num_elem, unsigned short **table)
> +{
> + int i;
> + size_t bytes;
> +
> + bytes = num_elem * sizeof(*table[0]);
> + *table = kmalloc(bytes, GFP_KERNEL);
> + WARN_ON_ONCE(!*table);
> + if (!*table)
> + return -ENOMEM;

WARN_ON_ONCE() is pass-through on the condition, so you can write this in a
shorter form:

if (!WARN_ON_ONCE(!*table))
return -ENOMEM;

> + uv_hub_info_list_blade = kzalloc(bytes, GFP_KERNEL);
> + WARN_ON_ONCE(!uv_hub_info_list_blade);
> + if (!uv_hub_info_list_blade)
> + return;

Ditto.

> + WARN_ON_ONCE(!new_hub);
> + if (!new_hub)
> + return;

Same. Also a memory leak of at least uv_hub_info_list_blade?

> + WARN_ON_ONCE(!__uv_hub_info_list);
> + if (!__uv_hub_info_list)
> + return;

Same.

> +
> + for_each_node(nodeid) {
> + __uv_hub_info_list[nodeid] = uv_hub_info_list_blade[uv_node_to_blade_id(nodeid)];
> + }

Unnecessary curly braces.

Looks good otherwise - presumably it's both tested and backwards compatible
with older UV hardware?

Thanks,

Ingo