Re: [PATCH 1/3] powerpc/smp: Reintroduce cpu_core_mask
From: Srikar Dronamraju <hidden>
Date: 2021-04-15 17:37:16
* Gautham R Shenoy [off-list ref] [2021-04-15 22:41:34]:
Hi Srikar,
Thanks for taking a look.
quoted
@@ -1485,12 +1486,36 @@ static void add_cpu_to_masks(int cpu) add_cpu_to_smallcore_masks(cpu); /* In CPU-hotplug path, hence use GFP_ATOMIC */ - alloc_cpumask_var_node(&mask, GFP_ATOMIC, cpu_to_node(cpu)); + ret = alloc_cpumask_var_node(&mask, GFP_ATOMIC, cpu_to_node(cpu)); update_mask_by_l2(cpu, &mask); if (has_coregroup_support()) update_coregroup_mask(cpu, &mask); + if (chip_id == -1 || !ret) { + cpumask_copy(per_cpu(cpu_core_map, cpu), cpu_cpu_mask(cpu)); + goto out; + } + + if (shared_caches) + submask_fn = cpu_l2_cache_mask; + + /* Update core_mask with all the CPUs that are part of submask */ + or_cpumasks_related(cpu, cpu, submask_fn, cpu_core_mask);If coregroups exist, we can add the cpus of the coregroup to the cpu_core_mask thereby reducing the scope of the for_each_cpu() search below. This will still cut down the time on Baremetal systems supporting coregroups.
Yes, once we upstream coregroup support to Baremetal, we should look at adding it. Also do note, number of CPUs we support for Baremetal is comparatively lower than in PowerVM + QEMU. And more importantly the number of cores per coregroup is also very low. So the optimization may not yield too much of a benefit. Its only in the QEMU case, where we end up having too many cores in the same chip, where we see a drastic increase in the boot-up time. -- Thanks and Regards Srikar Dronamraju