[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y9ESRzbzM0e8Kr1M@gmail.com>
Date: Wed, 25 Jan 2023 12:28:07 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Steve Wahl <steve.wahl@....com>
Cc: Dimitri Sivanich <dimitri.sivanich@....com>,
Russ Anderson <russ.anderson@....com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] x86/platform/uv: UV support for sub-NUMA clustering
* Steve Wahl <steve.wahl@....com> 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
Powered by blists - more mailing lists