[PATCHv10 3/4] genirq: Avoid summation loops for /proc/interrupts
Bitao Hu
yaoma at linux.alibaba.com
Wed Feb 28 17:07:15 AEDT 2024
On 2024/2/27 23:39, Thomas Gleixner wrote:
> On Tue, Feb 27 2024 at 19:20, Bitao Hu wrote:
>> On 2024/2/27 17:26, Thomas Gleixner wrote:
>>>
>>> and then let kstat_irqs() and show_interrupts() use it. See?
>>
>> I have a concern. kstat_irqs() uses for_each_possible_cpu() for
>> summation. However, show_interrupts() uses for_each_online_cpu(),
>> which means it only outputs interrupt statistics for online cpus.
>> If we use for_each_possible_cpu() in show_interrupts() to calculate
>> 'any_count', there could be a problem with the following scenario:
>> If an interrupt has a count of zero on online cpus but a non-zero
>> count on possible cpus, then 'any_count' would not be zero, and the
>> statistics for that interrupt would be output, which is not the
>> desired behavior for show_interrupts(). Therefore, I think it's not
>> good to have kstat_irqs() and show_interrupts() both use the same
>> logic. What do you think?
>
> Good point. But you simply can have
>
> unsigned int kstat_irq_desc(struct irq_desc *desc, const struct cpumask *mask)
>
> and hand in the appropriate cpumask, which still shares the code, no?
>
Alright, that is a good approach.
More information about the Linuxppc-dev
mailing list