Re: [PATCH v2] lib/group_cpus: Snapshot cluster masks to keep grouping hotplug invariant
"Badole, Vishal" <[email protected]>
| Newsgroups | org.kernel.vger.stable,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 8/20/2026 11:23 AM, Guo, Wangyang wrote:
>> +static void capture_cluster_snapshot(void) {
>
>> + /* Only capture when all present CPUs are online. */
>> + if (!data_race(cpumask_equal(cpu_present_mask, cpu_online_mask)))
> ...
> What if there is an ABA problem, some CPU offline during the snapshot creation but becomes
> online before this check, snapshot may capture the torn data but below check still pass.
>
>> + /* Drop it if a CPU changed state mid-copy; never latch a torn view. */
>> + if (!data_race(cpumask_equal(cpu_present_mask, cpu_online_mask))) {
>> + for_each_possible_cpu(cpu)
>> + free_cpumask_var(snapshot[cpu]);
>> + kfree(snapshot);
>> + goto out;
>> + }
>
> What about check snapshot against cpu_present_mask?
Hi Wangyang,
Thanks for the review. Both comments are valid - I will address them in
the next revision.