Re: [PATCH] lscpu: fix incorrect number of sockets during hotplug

Karel Zak <[email protected]>
Newsgroups org.kernel.vger.util-linux
Message-ID <psbp7ofmppegfcgz6w4jzaqx5ek5yeoc7zqeoh7k5bmdpp4ivg@4xkmw5pmsp4t>
 HI,

 sorry for delay with review.

On Fri, Oct 18, 2024 at 04:13:35PM GMT, Anjali K wrote:
>  /* add @set to the @ary, unnecessary set is deallocated. */
> -static int add_cpuset_to_array(cpu_set_t **ary, size_t *items, cpu_set_t *set, size_t setsize)
> +static int add_cpuset_to_array(cpu_set_t **ary, size_t *items, cpu_set_t *set, size_t setsize, int maxcpus)
>  {
> +	cpu_set_t *common_cpus_set;
>  	size_t i;
>  
>  	if (!ary)
>  		return -EINVAL;
>  
> +	common_cpus_set = CPU_ALLOC(maxcpus);
> +	if (!common_cpus_set)
> +		return -EINVAL;

Would be better to allocate this only once in cputype_read_topology()
and reuse it for all the arrays and CPUs? 

The rest looks good. Thanks!

 Karel



-- 
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.