On 19/07/18 15:20, Lorenzo Pieralisi wrote:
> On Thu, Jul 19, 2018 at 02:35:49PM +0100, Sudeep Holla wrote:
[...]
>> +static cpumask_var_t *alloc_cpu_groups(int num)
>> +{
>> + int i;
>> + cpumask_var_t *cpu_groups;
>> +
>> + cpu_groups = kcalloc(num, sizeof(cpu_groups), GFP_KERNEL);
>> + if (!cpu_groups)
>> + return NULL;
>> +
>> + for (i = 0; i < num; ++i)
>> + if (!alloc_cpumask_var(&cpu_groups[i], GFP_KERNEL)) {
>> + free_cpu_groups(num, cpu_groups);
>> + return NULL;
>> + }
>> +
>> + return cpu_groups;
>> +}
>
> Sorry for being a PITA - I meant we could remove find_cpu_groups()
Sorry that's exactly what I understood when I read it, but ...
got distracted with something else and when I returned back to it,
implemented something else.
> entirely and embed it in alloc_cpu_groups(), that takes a cpumask_t
> pointer and return the number of groups, again, to make it more
> readable but that's just my opinion.
>
Sorry for not showing that much love to this, not paying too much
attention as it's test code :).
--
Regards,
Sudeep