Commit b21ddbf5 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by Konrad Rzeszutek Wilk

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: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 0794bfc7
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/irqnr.h>
#include <asm/desc.h> #include <asm/desc.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
...@@ -97,11 +98,9 @@ struct irq_info ...@@ -97,11 +98,9 @@ struct irq_info
}; };
#define PIRQ_NEEDS_EOI (1 << 0) #define PIRQ_NEEDS_EOI (1 << 0)
static struct irq_info irq_info[NR_IRQS]; static struct irq_info *irq_info;
static int evtchn_to_irq[NR_EVENT_CHANNELS] = { static int *evtchn_to_irq;
[0 ... NR_EVENT_CHANNELS-1] = -1
};
struct cpu_evtchn_s { struct cpu_evtchn_s {
unsigned long bits[NR_EVENT_CHANNELS/BITS_PER_LONG]; unsigned long bits[NR_EVENT_CHANNELS/BITS_PER_LONG];
}; };
...@@ -527,7 +526,7 @@ static int find_irq_by_gsi(unsigned gsi) ...@@ -527,7 +526,7 @@ static int find_irq_by_gsi(unsigned gsi)
{ {
int irq; int irq;
for (irq = 0; irq < NR_IRQS; irq++) { for (irq = 0; irq < nr_irqs; irq++) {
struct irq_info *info = info_for_irq(irq); struct irq_info *info = info_for_irq(irq);
if (info == NULL || info->type != IRQT_PIRQ) if (info == NULL || info->type != IRQT_PIRQ)
...@@ -1267,7 +1266,12 @@ void __init xen_init_IRQ(void) ...@@ -1267,7 +1266,12 @@ void __init xen_init_IRQ(void)
cpu_evtchn_mask_p = kcalloc(nr_cpu_ids, sizeof(struct cpu_evtchn_s), cpu_evtchn_mask_p = kcalloc(nr_cpu_ids, sizeof(struct cpu_evtchn_s),
GFP_KERNEL); GFP_KERNEL);
BUG_ON(cpu_evtchn_mask_p == NULL); irq_info = kcalloc(nr_irqs, sizeof(*irq_info), GFP_KERNEL);
evtchn_to_irq = kcalloc(NR_EVENT_CHANNELS, sizeof(*evtchn_to_irq),
GFP_KERNEL);
for (i = 0; i < NR_EVENT_CHANNELS; i++)
evtchn_to_irq[i] = -1;
init_evtchn_cpu_bindings(); init_evtchn_cpu_bindings();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment