|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] [PATCH 13/18] xen: dynamically allocate irq & event structur
From: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
Impact: reduce memory usage
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@xxxxxxx>.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
---
drivers/xen/events.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 4a15326..64200a0 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -27,6 +27,7 @@
#include <linux/module.h>
#include <linux/string.h>
#include <linux/bootmem.h>
+#include <linux/irqnr.h>
#include <asm/ptrace.h>
#include <asm/irq.h>
@@ -91,11 +92,9 @@ struct irq_info
};
#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] = {
- [0 ... NR_EVENT_CHANNELS-1] = -1
-};
+static int *evtchn_to_irq;
struct cpu_evtchn_s {
unsigned long bits[NR_EVENT_CHANNELS/BITS_PER_LONG];
};
@@ -515,7 +514,7 @@ static int find_irq_by_gsi(unsigned gsi)
{
int irq;
- for(irq = 0; irq < NR_IRQS; irq++) {
+ for(irq = 0; irq < nr_irqs; irq++) {
struct irq_info *info = info_for_irq(irq);
if (info == NULL || info->type != IRQT_PIRQ)
@@ -1180,7 +1179,11 @@ void __init xen_init_IRQ(void)
size_t size = nr_cpu_ids * sizeof(struct cpu_evtchn_s);
cpu_evtchn_mask_p = alloc_bootmem(size);
- BUG_ON(cpu_evtchn_mask_p == NULL);
+ irq_info = alloc_bootmem(nr_irqs * sizeof(*irq_info));
+
+ evtchn_to_irq = alloc_bootmem(NR_EVENT_CHANNELS *
sizeof(*evtchn_to_irq));
+ for(i = 0; i < NR_EVENT_CHANNELS; i++)
+ evtchn_to_irq[i] = -1;
init_evtchn_cpu_bindings();
--
1.6.0.6
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] [PATCH 08/18] xen: bind pirq to vector and event channel, (continued)
- [Xen-devel] [PATCH 08/18] xen: bind pirq to vector and event channel, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 04/18] xen: implement pirq type event channels, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 06/18] xen/apic: identity map gsi->irqs, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 07/18] xen: direct irq registration to pirq event channels, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 09/18] xen: pre-initialize legacy irqs early, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 10/18] xen: don't setup acpi interrupt unless there is one, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 11/18] xen: use acpi_get_override_irq() to get triggering for legacy irqs, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 12/18] xen: initialize irq 0 too, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 16/18] xen: disable MSI, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 05/18] x86/io_apic: add get_nr_irqs_gsi(), Jeremy Fitzhardinge
- [Xen-devel] [PATCH 13/18] xen: dynamically allocate irq & event structures,
Jeremy Fitzhardinge <=
- [Xen-devel] [PATCH 01/18] xen/dom0: handle acpi lapic parsing in Xen dom0, Jeremy Fitzhardinge
- [Xen-devel] [PATCH 15/18] xen: fix legacy irq setup, make ioapic-less machines work., Jeremy Fitzhardinge
- [Xen-devel] [PATCH 02/18] xen: hook io_apic read/write operations, Jeremy Fitzhardinge
|
|
|
|
|