Re: [PATCH v3] lib/group_cpus: Snapshot cluster masks to keep grouping hotplug invariant

From: Badole, Vishal

Date: Tue Aug 25 2026 - 09:21:51 EST




On 8/25/2026 12:14 PM, Guo, Wangyang wrote:
+ for_each_possible_cpu(cpu) {
+ if (!zalloc_cpumask_var(&snapshot[cpu], GFP_KERNEL)) {
+ while (cpu--)
for_each_possible_cpu(cpu) may have holes, but "while (cpu--)" assume the enumeration is dense.
Although freeing NULL is not a bug, it worths a comment or check for such subtle thing.
+ free_cpumask_var(snapshot[cpu]);
+ kfree(snapshot);
+ goto out;
+ }
+ }

Thanks for the review. Sure, I will address this in the next revision.