Re: [PATCH v3 4/4] /proc/stat: Call kstat_irqs_usr() only for active IRQs

From: Waiman Long
Date: Tue Jan 15 2019 - 10:52:33 EST


On 01/15/2019 04:24 AM, Thomas Gleixner wrote:
> Waiman,
>
> On Mon, 14 Jan 2019, Waiman Long wrote:
>> On 01/11/2019 04:02 PM, Thomas Gleixner wrote:
>>> @@ -919,11 +920,15 @@ unsigned int kstat_irqs_cpu(unsigned int
>>> unsigned int kstat_irqs(unsigned int irq)
>>> {
>>> struct irq_desc *desc = irq_to_desc(irq);
>>> - int cpu;
>>> unsigned int sum = 0;
>>> + int cpu;
>>>
>>> if (!desc || !desc->kstat_irqs)
>>> return 0;
>>> + if (!irq_settings_is_per_cpu_devid(desc) &&
>>> + !irq_settings_is_per_cpu(desc))
>>> + return desc->tot_count;
>>> +
>>> for_each_possible_cpu(cpu)
>>> sum += *per_cpu_ptr(desc->kstat_irqs, cpu);
>>> return sum;
>>>
>>>
>> That looks good to me. Thanks for providing a more simple solution.
>>
>> BTW, if the percpu IRQ is known at allocation time, maybe we should just
>> not allocate a percpu count for the corresponding descriptor.
> Nope. You still need the per cpu accounting for /proc/interrupts ..

Yes, you are right.

Thanks,
Longman