RE: [PATCH v3] lib/group_cpus: Snapshot cluster masks to keep grouping hotplug invariant
"Guo, Wangyang" <[email protected]>
| Newsgroups | org.kernel.vger.stable,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <DS0PR11MB80186E471C1553ADAB16FEA592AF2@DS0PR11MB8018.namprd11.prod.outlook.com> |
+ 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;
+ }
+ }