From: Yinghai Lu <yinghai@kernel.org>
To: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>
Cc: Mike Travis <travis@sgi.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] x86: arch_probe_nr_irqs
Date: Mon, 12 Jan 2009 11:53:39 -0800 [thread overview]
Message-ID: <496B9FC3.7080306@kernel.org> (raw)
In-Reply-To: <20090112092613.GA1822@elte.hu>
Impact: save RAM with large NR_CPUS, get smaller nr_irqs
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/include/asm/irq_vectors.h | 7 ++-----
arch/x86/kernel/io_apic.c | 16 ++++++++++++++++
include/linux/interrupt.h | 1 +
kernel/irq/handle.c | 9 ++-------
kernel/softirq.c | 5 +++++
5 files changed, 26 insertions(+), 12 deletions(-)
Index: linux-2.6/arch/x86/include/asm/irq_vectors.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/irq_vectors.h
+++ linux-2.6/arch/x86/include/asm/irq_vectors.h
@@ -120,14 +120,11 @@
# endif
#else
-/* defined as a macro so nr_irqs = max_nr_irqs(nr_cpu_ids) can be used */
-# define max_nr_irqs(nr_cpus) \
- ((8 * nr_cpus) > (32 * MAX_IO_APICS) ? \
+# define NR_IRQS \
+ ((8 * NR_CPUS) > (32 * MAX_IO_APICS) ? \
(NR_VECTORS + (8 * NR_CPUS)) : \
(NR_VECTORS + (32 * MAX_IO_APICS))) \
-# define NR_IRQS max_nr_irqs(NR_CPUS)
-
#endif
#elif defined(CONFIG_X86_VOYAGER)
Index: linux-2.6/arch/x86/kernel/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/io_apic.c
+++ linux-2.6/arch/x86/kernel/io_apic.c
@@ -3851,6 +3851,22 @@ void __init probe_nr_irqs_gsi(void)
nr_irqs_gsi = nr;
}
+#ifdef CONFIG_SPARSE_IRQ
+int __init arch_probe_nr_irqs(void)
+{
+ int nr;
+
+ nr = ((8 * nr_cpu_ids) > (32 * nr_ioapics) ?
+ (NR_VECTORS + (8 * nr_cpu_ids)) :
+ (NR_VECTORS + (32 * nr_ioapics)));
+
+ if (nr < nr_irqs && nr > nr_irqs_gsi)
+ nr_irqs = nr;
+
+ return 0;
+}
+#endif
+
/* --------------------------------------------------------------------------
ACPI-based IOAPIC Configuration
-------------------------------------------------------------------------- */
Index: linux-2.6/include/linux/interrupt.h
===================================================================
--- linux-2.6.orig/include/linux/interrupt.h
+++ linux-2.6/include/linux/interrupt.h
@@ -481,6 +481,7 @@ int show_interrupts(struct seq_file *p,
struct irq_desc;
extern int early_irq_init(void);
+extern int arch_probe_nr_irqs(void);
extern int arch_early_irq_init(void);
extern int arch_init_chip_data(struct irq_desc *desc, int cpu);
Index: linux-2.6/kernel/irq/handle.c
===================================================================
--- linux-2.6.orig/kernel/irq/handle.c
+++ linux-2.6/kernel/irq/handle.c
@@ -59,10 +59,6 @@ EXPORT_SYMBOL_GPL(nr_irqs);
#ifdef CONFIG_SPARSE_IRQ
-#ifndef max_nr_irqs
-#define max_nr_irqs(nr_cpus) NR_IRQS
-#endif
-
static struct irq_desc irq_desc_init = {
.irq = -1,
.status = IRQ_DISABLED,
@@ -137,9 +133,8 @@ int __init early_irq_init(void)
int legacy_count;
int i;
- /* initialize nr_irqs based on nr_cpu_ids */
- nr_irqs = max_nr_irqs(nr_cpu_ids);
-
+ /* initialize nr_irqs based on nr_cpu_ids */
+ arch_probe_nr_irqs();
printk(KERN_INFO "NR_IRQS:%d nr_irqs:%d\n", NR_IRQS, nr_irqs);
desc = irq_desc_legacy;
Index: linux-2.6/kernel/softirq.c
===================================================================
--- linux-2.6.orig/kernel/softirq.c
+++ linux-2.6/kernel/softirq.c
@@ -806,6 +806,11 @@ int __init __weak early_irq_init(void)
return 0;
}
+int __init __weak arch_probe_nr_irqs(void)
+{
+ return 0;
+}
+
int __init __weak arch_early_irq_init(void)
{
return 0;
next prev parent reply other threads:[~2009-01-12 19:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-12 5:42 [PATCH] x86: include apicnum.h in acpidef.h Yinghai Lu
2009-01-12 9:19 ` Ingo Molnar
2009-01-12 9:26 ` Ingo Molnar
2009-01-12 9:27 ` Ingo Molnar
2009-01-12 19:53 ` Yinghai Lu [this message]
2009-01-12 23:07 ` [PATCH] x86: arch_probe_nr_irqs Mike Travis
2009-01-14 11:19 ` Ingo Molnar
2009-01-14 19:50 ` Mike Travis
2009-01-14 20:11 ` Ingo Molnar
2009-01-14 21:26 ` Mike Travis
2009-01-15 9:49 ` Ingo Molnar
2009-01-15 20:53 ` Mike Travis
2009-01-15 21:02 ` Ingo Molnar
2009-01-12 19:09 ` [PATCH] x86: include apicnum.h in acpidef.h Mike Travis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=496B9FC3.7080306@kernel.org \
--to=yinghai@kernel.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=travis@sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox