aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2009-05-28 21:14:40 -0400
committerPekka Enberg <penberg@cs.helsinki.fi>2009-06-11 12:27:08 -0400
commitdad213aeb59718623fc59defeff95fe8c3feb8a0 (patch)
tree3b43b199f0c8a03f010f03087428b0d6c67cd75c
parent38c7fed2f5ffee17e1fa3e0f78b0e1bf43d52d13 (diff)
irq/cpumask: make memoryless node zero happy
Don't hardcode to node zero for early boot IRQ setup memory allocations. [ penberg@cs.helsinki.fi: minor cleanups ] Cc: Ingo Molnar <mingo@elte.hu> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
-rw-r--r--arch/x86/kernel/apic/io_apic.c6
-rw-r--r--kernel/irq/handle.c9
2 files changed, 9 insertions, 6 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 139201a562ba..94605e7f6a54 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -177,16 +177,18 @@ int __init arch_early_irq_init(void)
177 struct irq_cfg *cfg; 177 struct irq_cfg *cfg;
178 struct irq_desc *desc; 178 struct irq_desc *desc;
179 int count; 179 int count;
180 int node;
180 int i; 181 int i;
181 182
182 cfg = irq_cfgx; 183 cfg = irq_cfgx;
183 count = ARRAY_SIZE(irq_cfgx); 184 count = ARRAY_SIZE(irq_cfgx);
185 node= cpu_to_node(boot_cpu_id);
184 186
185 for (i = 0; i < count; i++) { 187 for (i = 0; i < count; i++) {
186 desc = irq_to_desc(i); 188 desc = irq_to_desc(i);
187 desc->chip_data = &cfg[i]; 189 desc->chip_data = &cfg[i];
188 alloc_cpumask_var(&cfg[i].domain, GFP_NOWAIT); 190 alloc_cpumask_var_node(&cfg[i].domain, GFP_NOWAIT, node);
189 alloc_cpumask_var(&cfg[i].old_domain, GFP_NOWAIT); 191 alloc_cpumask_var_node(&cfg[i].old_domain, GFP_NOWAIT, node);
190 if (i < NR_IRQS_LEGACY) 192 if (i < NR_IRQS_LEGACY)
191 cpumask_setall(cfg[i].domain); 193 cpumask_setall(cfg[i].domain);
192 } 194 }
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index a60018402f42..e161999b6683 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -150,6 +150,7 @@ int __init early_irq_init(void)
150{ 150{
151 struct irq_desc *desc; 151 struct irq_desc *desc;
152 int legacy_count; 152 int legacy_count;
153 int node;
153 int i; 154 int i;
154 155
155 init_irq_default_affinity(); 156 init_irq_default_affinity();
@@ -160,20 +161,20 @@ int __init early_irq_init(void)
160 161
161 desc = irq_desc_legacy; 162 desc = irq_desc_legacy;
162 legacy_count = ARRAY_SIZE(irq_desc_legacy); 163 legacy_count = ARRAY_SIZE(irq_desc_legacy);
164 node = first_online_node;
163 165
164 /* allocate irq_desc_ptrs array based on nr_irqs */ 166 /* allocate irq_desc_ptrs array based on nr_irqs */
165 irq_desc_ptrs = alloc_bootmem(nr_irqs * sizeof(void *)); 167 irq_desc_ptrs = alloc_bootmem(nr_irqs * sizeof(void *));
166 168
167 /* allocate based on nr_cpu_ids */ 169 /* allocate based on nr_cpu_ids */
168 /* FIXME: invert kstat_irgs, and it'd be a per_cpu_alloc'd thing */ 170 kstat_irqs_legacy = kzalloc_node(NR_IRQS_LEGACY * nr_cpu_ids *
169 kstat_irqs_legacy = alloc_bootmem(NR_IRQS_LEGACY * nr_cpu_ids * 171 sizeof(int), GFP_NOWAIT, node);
170 sizeof(int));
171 172
172 for (i = 0; i < legacy_count; i++) { 173 for (i = 0; i < legacy_count; i++) {
173 desc[i].irq = i; 174 desc[i].irq = i;
174 desc[i].kstat_irqs = kstat_irqs_legacy + i * nr_cpu_ids; 175 desc[i].kstat_irqs = kstat_irqs_legacy + i * nr_cpu_ids;
175 lockdep_set_class(&desc[i].lock, &irq_desc_lock_class); 176 lockdep_set_class(&desc[i].lock, &irq_desc_lock_class);
176 alloc_desc_masks(&desc[i], 0, true); 177 alloc_desc_masks(&desc[i], node, true);
177 init_desc_masks(&desc[i]); 178 init_desc_masks(&desc[i]);
178 irq_desc_ptrs[i] = desc + i; 179 irq_desc_ptrs[i] = desc + i;
179 } 180 }