Re: [PATCH v4 1/9] lib/group_cpus: let group_cpu_evenly return number of groups

Hannes Reinecke
2025-01-07T13:45:26Z

On 1/7/25 09:20, Daniel Wagner wrote:
> On Tue, Jan 07, 2025 at 08:51:57AM +0100, Hannes Reinecke wrote:
>>> void blk_mq_map_queues(struct blk_mq_queue_map *qmap)
>>> {
>>> const struct cpumask *masks;
>>> - unsigned int queue, cpu;
>>> + unsigned int queue, cpu, nr_masks;
>>> - masks = group_cpus_evenly(qmap->nr_queues);
>>> + nr_masks = qmap->nr_queues;
>>> + masks = group_cpus_evenly(&nr_masks);
>>
>> Hmph. I am a big fan of separating input and output paramenters;
>> most ABI definitions will be doing that anyway.
>> Makes it also really hard to track whether the output parameters
>> had been set at all. Care to split it up?
>
> What API do you have in mind?

ABI, not API.
x86 ABI has 'rdi' as the first input register, and 'rax' as the first
output register. So there is no difference for the compiler whether
you have 'x(&a); b = a;' or 'x(a, &b)'.
But you gain on usability, as in the second case you can check whether
'b' had been set by the function.

Cheers,

Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich