[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f8c0f152-cd70-4a25-a52d-e1692c6dbc28@kernel.org>
Date: Thu, 6 Nov 2025 07:44:37 +0100
From: Jiri Slaby <jirislaby@...nel.org>
To: ray <veidongray@...com>, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>
Cc: x86@...nel.org, "H . Peter Anvin" <hpa@...or.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/irq: Precompute nr_legacy_irqs() for performance
optimization
Hi,
On 01. 11. 25, 12:26, ray wrote:
> Precompute the return value of nr_legacy_irqs() in init_ISA_irqs(),
> init_IRQ(), and native_init_IRQ() functions to avoid repeated function
> calls in loops, improving performance.
>
> Changes made:
> - Precompute nr_legacy_irqs() return value in three functions
> - Use local variables instead of function calls in loops
> - Maintain original logic unchanged
>
> Signed-off-by: ray <veidongray@...com>
Is this how you sign legal documents?
> index 6ab9eac64670..bb7cbf99f65c 100644
> --- a/arch/x86/kernel/irqinit.c
> +++ b/arch/x86/kernel/irqinit.c
...
> @@ -66,7 +66,9 @@ void __init init_ISA_irqs(void)
>
> legacy_pic->init(0);
>
> - for (i = 0; i < nr_legacy_irqs(); i++) {
> + nr_legacy = nr_legacy_irqs();
> +
> + for (i = 0; i < nr_legacy; i++) {
nr_legacy_irqs() is a static inline, so this was not a call per se.
Instead, this resolves to 2 memory reads. Is the change worth it at all,
provided these are NOT a fast path?
> @@ -106,7 +112,9 @@ void __init native_init_IRQ(void)
>
> lapic_assign_system_vectors();
>
> - if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs()) {
> + nr_legacy = nr_legacy_irqs();
> +
> + if (!acpi_ioapic && !of_ioapic && nr_legacy) {
What's the added value in here at all?
thanks,
--
js
suse labs
Powered by blists - more mailing lists