aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2009-01-12 20:39:24 -0500
committerMike Travis <travis@sgi.com>2009-01-12 20:39:24 -0500
commit4a046d1754ee6ebb6f399696805ed61ea0444d4c (patch)
tree9b9e8e63d9490aea4c2f06263ad541cb8115eb63
parente65e49d0f3714f4a6a42f6f6a19926ba33fcda75 (diff)
x86: arch_probe_nr_irqs
Impact: save RAM with large NR_CPUS, get smaller nr_irqs Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Mike Travis <travis@sgi.com>
-rw-r--r--arch/x86/include/asm/irq_vectors.h7
-rw-r--r--arch/x86/kernel/io_apic.c16
-rw-r--r--include/linux/interrupt.h1
-rw-r--r--kernel/irq/handle.c9
-rw-r--r--kernel/softirq.c5
5 files changed, 26 insertions, 12 deletions
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
index 602361ad0e74..a16a2ab2b429 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -115,14 +115,11 @@
115# endif 115# endif
116#else 116#else
117 117
118/* defined as a macro so nr_irqs = max_nr_irqs(nr_cpu_ids) can be used */ 118# define NR_IRQS \
119# define max_nr_irqs(nr_cpus) \ 119 ((8 * NR_CPUS) > (32 * MAX_IO_APICS) ? \
120 ((8 * nr_cpus) > (32 * MAX_IO_APICS) ? \
121 (NR_VECTORS + (8 * NR_CPUS)) : \ 120 (NR_VECTORS + (8 * NR_CPUS)) : \
122 (NR_VECTORS + (32 * MAX_IO_APICS))) \ 121 (NR_VECTORS + (32 * MAX_IO_APICS))) \
123 122
124# define NR_IRQS max_nr_irqs(NR_CPUS)
125
126#endif 123#endif
127 124
128#elif defined(CONFIG_X86_VOYAGER) 125#elif defined(CONFIG_X86_VOYAGER)
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c
index ae80638012de..157986916cd1 100644
--- a/arch/x86/kernel/io_apic.c
+++ b/arch/x86/kernel/io_apic.c
@@ -3850,6 +3850,22 @@ void __init probe_nr_irqs_gsi(void)
3850 nr_irqs_gsi = nr; 3850 nr_irqs_gsi = nr;
3851} 3851}
3852 3852
3853#ifdef CONFIG_SPARSE_IRQ
3854int __init arch_probe_nr_irqs(void)
3855{
3856 int nr;
3857
3858 nr = ((8 * nr_cpu_ids) > (32 * nr_ioapics) ?
3859 (NR_VECTORS + (8 * nr_cpu_ids)) :
3860 (NR_VECTORS + (32 * nr_ioapics)));
3861
3862 if (nr < nr_irqs && nr > nr_irqs_gsi)
3863 nr_irqs = nr;
3864
3865 return 0;
3866}
3867#endif
3868
3853/* -------------------------------------------------------------------------- 3869/* --------------------------------------------------------------------------
3854 ACPI-based IOAPIC Configuration 3870 ACPI-based IOAPIC Configuration
3855 -------------------------------------------------------------------------- */ 3871 -------------------------------------------------------------------------- */
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 9127f6b51a39..472f11765f60 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -467,6 +467,7 @@ int show_interrupts(struct seq_file *p, void *v);
467struct irq_desc; 467struct irq_desc;
468 468
469extern int early_irq_init(void); 469extern int early_irq_init(void);
470extern int arch_probe_nr_irqs(void);
470extern int arch_early_irq_init(void); 471extern int arch_early_irq_init(void);
471extern int arch_init_chip_data(struct irq_desc *desc, int cpu); 472extern int arch_init_chip_data(struct irq_desc *desc, int cpu);
472 473
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 04d3e46031e5..375d68cd5bf0 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -59,10 +59,6 @@ EXPORT_SYMBOL_GPL(nr_irqs);
59 59
60#ifdef CONFIG_SPARSE_IRQ 60#ifdef CONFIG_SPARSE_IRQ
61 61
62#ifndef max_nr_irqs
63#define max_nr_irqs(nr_cpus) NR_IRQS
64#endif
65
66static struct irq_desc irq_desc_init = { 62static struct irq_desc irq_desc_init = {
67 .irq = -1, 63 .irq = -1,
68 .status = IRQ_DISABLED, 64 .status = IRQ_DISABLED,
@@ -137,9 +133,8 @@ int __init early_irq_init(void)
137 int legacy_count; 133 int legacy_count;
138 int i; 134 int i;
139 135
140 /* initialize nr_irqs based on nr_cpu_ids */ 136 /* initialize nr_irqs based on nr_cpu_ids */
141 nr_irqs = max_nr_irqs(nr_cpu_ids); 137 arch_probe_nr_irqs();
142
143 printk(KERN_INFO "NR_IRQS:%d nr_irqs:%d\n", NR_IRQS, nr_irqs); 138 printk(KERN_INFO "NR_IRQS:%d nr_irqs:%d\n", NR_IRQS, nr_irqs);
144 139
145 desc = irq_desc_legacy; 140 desc = irq_desc_legacy;
diff --git a/kernel/softirq.c b/kernel/softirq.c
index bdbe9de9cd8d..0365b4899a3d 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -795,6 +795,11 @@ int __init __weak early_irq_init(void)
795 return 0; 795 return 0;
796} 796}
797 797
798int __init __weak arch_probe_nr_irqs(void)
799{
800 return 0;
801}
802
798int __init __weak arch_early_irq_init(void) 803int __init __weak arch_early_irq_init(void)
799{ 804{
800 return 0; 805 return 0;