aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2010-06-07 16:28:49 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2010-10-18 10:41:42 -0400
commitb21ddbf50386d10cdd60d8f8e744cff0496d2552 (patch)
treefdd4a7ef7010262e22ad80797ac79578d63f3858
parent0794bfc74365d0de4b1d4920cb71031850551cbd (diff)
xen: dynamically allocate irq & event structures
Dynamically allocate the irq_info and evtchn_to_irq arrays, so that 1) the irq_info array scales to the actual number of possible irqs, and 2) we don't needlessly increase the static size of the kernel when we aren't running under Xen. Derived on patch from Mike Travis <travis@sgi.com>. [Impact: reduce memory usage ] [v2: Conflict in drivers/xen/events.c: Replaced alloc_bootmen with kcalloc ] Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
-rw-r--r--drivers/xen/events.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 1bb51e459ab2..19a93297e890 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -28,6 +28,7 @@
28#include <linux/string.h> 28#include <linux/string.h>
29#include <linux/bootmem.h> 29#include <linux/bootmem.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/irqnr.h>
31 32
32#include <asm/desc.h> 33#include <asm/desc.h>
33#include <asm/ptrace.h> 34#include <asm/ptrace.h>
@@ -97,11 +98,9 @@ struct irq_info
97}; 98};
98#define PIRQ_NEEDS_EOI (1 << 0) 99#define PIRQ_NEEDS_EOI (1 << 0)
99 100
100static struct irq_info irq_info[NR_IRQS]; 101static struct irq_info *irq_info;
101 102
102static int evtchn_to_irq[NR_EVENT_CHANNELS] = { 103static int *evtchn_to_irq;
103 [0 ... NR_EVENT_CHANNELS-1] = -1
104};
105struct cpu_evtchn_s { 104struct cpu_evtchn_s {
106 unsigned long bits[NR_EVENT_CHANNELS/BITS_PER_LONG]; 105 unsigned long bits[NR_EVENT_CHANNELS/BITS_PER_LONG];
107}; 106};
@@ -527,7 +526,7 @@ static int find_irq_by_gsi(unsigned gsi)
527{ 526{
528 int irq; 527 int irq;
529 528
530 for (irq = 0; irq < NR_IRQS; irq++) { 529 for (irq = 0; irq < nr_irqs; irq++) {
531 struct irq_info *info = info_for_irq(irq); 530 struct irq_info *info = info_for_irq(irq);
532 531
533 if (info == NULL || info->type != IRQT_PIRQ) 532 if (info == NULL || info->type != IRQT_PIRQ)
@@ -1267,7 +1266,12 @@ void __init xen_init_IRQ(void)
1267 1266
1268 cpu_evtchn_mask_p = kcalloc(nr_cpu_ids, sizeof(struct cpu_evtchn_s), 1267 cpu_evtchn_mask_p = kcalloc(nr_cpu_ids, sizeof(struct cpu_evtchn_s),
1269 GFP_KERNEL); 1268 GFP_KERNEL);
1270 BUG_ON(cpu_evtchn_mask_p == NULL); 1269 irq_info = kcalloc(nr_irqs, sizeof(*irq_info), GFP_KERNEL);
1270
1271 evtchn_to_irq = kcalloc(NR_EVENT_CHANNELS, sizeof(*evtchn_to_irq),
1272 GFP_KERNEL);
1273 for (i = 0; i < NR_EVENT_CHANNELS; i++)
1274 evtchn_to_irq[i] = -1;
1271 1275
1272 init_evtchn_cpu_bindings(); 1276 init_evtchn_cpu_bindings();
1273 1277