[RFC 07/12] arm64: tlbid: Set up CPU domain bitmaps

Jinqian Yang yangjinqian1 at huawei.com
Mon Oct 19 00:50:06 PDT 2026


Hi,

On 2026/10/1 19:06, Kristina Martšenko wrote:
> +static int __init init_cpu_domain_bitmaps(struct tlbi_domain *domains)
> +{
> +	int cpu;
> +
> +	cpu_domains = kcalloc(nr_cpu_ids, sizeof(*cpu_domains), GFP_KERNEL);
> +	if (!cpu_domains)
> +		return -ENOMEM;
> +
> +	for_each_possible_cpu(cpu) {
> +		cpu_domains[cpu] = bitmap_zalloc(domain_count, GFP_KERNEL);
> +		if (!cpu_domains[cpu])
> +			return -ENOMEM;
> +
> +		for (int i = 0; i < domain_count; i++) {
> +			if (cpumask_test_cpu(cpu, domains[i].cpus))
> +				set_bit(i, cpu_domains[cpu]);
> +		}
> +	}
> +
> +	return 0;
> +}
The same minor issue: init_cpu_domain_bitmaps has a memory leak per CPU
if bitmap_zalloc() fails during execution, the allocated bitmap will be
leaked.

Thanks,
Jinqian



More information about the linux-arm-kernel mailing list