Re: [patch 06/14] genirq: Cache the condition for /proc/interrupts exposure

From: Dmitry Ilvokhin

Date: Mon Mar 16 2026 - 14:52:38 EST


On Wed, Mar 04, 2026 at 07:55:53PM +0100, Thomas Gleixner wrote:
> show_interrupts() evaluates a boatload of conditions to establish whether
> exposing an interrupt in /proc/interrupts or not.
>
> That can be simplified by caching the condition in an internal status flag,
> which is updated when one of the relevant inputs changes.
>
> As a result the number of instructions and branches for reading
> /proc/interrupts is reduced significantly.
>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
> ---
> include/linux/irq.h | 1 +
> kernel/irq/chip.c | 2 ++
> kernel/irq/internals.h | 2 ++
> kernel/irq/manage.c | 2 ++
> kernel/irq/proc.c | 16 ++++++++++++----
> kernel/irq/settings.h | 14 ++++++++++++++
> 6 files changed, 33 insertions(+), 4 deletions(-)
>
> --- a/include/linux/irq.h
> +++ b/include/linux/irq.h
> @@ -99,6 +99,7 @@ enum {
> IRQ_DISABLE_UNLAZY = (1 << 19),
> IRQ_HIDDEN = (1 << 20),
> IRQ_NO_DEBUG = (1 << 21),
> + IRQF_RESERVED = (1 << 22),
> };

nit: IRQF_ prefix doesn't match the IRQ_ convention used by the other
entries in the enum.

[...]

> --- a/kernel/irq/settings.h
> +++ b/kernel/irq/settings.h
> @@ -37,6 +37,9 @@ enum {
> #undef IRQF_MODIFY_MASK
> #define IRQF_MODIFY_MASK GOT_YOU_MORON
>
> +#define _IRQ_PROC_VALID IRQF_RESERVED
> +#undef IRQF_RESERVED

The #undef IRQF_RESERVED is a no-op since IRQF_RESERVED is an enum
constant, not a macro. Probably, need to follow the same pattern as
values above to shadow with GOT_YOU_MORON.

Other than that:

Reviewed-by: Dmitry Ilvokhin <d@xxxxxxxxxxxx>