xen-devel
[Xen-devel] [PATCH 06/23] xen: dynamically allocate irq & event structur
To: |
linux-kernel@xxxxxxxxxxxxxxx |
Subject: |
[Xen-devel] [PATCH 06/23] xen: dynamically allocate irq & event structures |
From: |
Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> |
Date: |
Tue, 12 Oct 2010 11:44:14 -0400 |
Cc: |
Jeremy Fitzhardinge <jeremy@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>, Konrad Rzeszutek Wilk <konrad@xxxxxxxxxx>, Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx> |
Delivery-date: |
Tue, 12 Oct 2010 09:11:23 -0700 |
Envelope-to: |
www-data@xxxxxxxxxxxxxxxxxxx |
In-reply-to: |
<1286898271-32018-1-git-send-email-konrad.wilk@xxxxxxxxxx> |
List-help: |
<mailto:xen-devel-request@lists.xensource.com?subject=help> |
List-id: |
Xen developer discussion <xen-devel.lists.xensource.com> |
List-post: |
<mailto:xen-devel@lists.xensource.com> |
List-subscribe: |
<http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe> |
List-unsubscribe: |
<http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe> |
References: |
<1286898271-32018-1-git-send-email-konrad.wilk@xxxxxxxxxx> |
Sender: |
xen-devel-bounces@xxxxxxxxxxxxxxxxxxx |
From: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
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>.
[Impact: reduce memory usage ]
[v2: Conflict in drivers/xen/events.c: Replaced alloc_bootmen with kcalloc ]
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
drivers/xen/events.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 8eeb808..25412ef 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -28,6 +28,7 @@
#include <linux/string.h>
#include <linux/bootmem.h>
#include <linux/slab.h>
+#include <linux/irqnr.h>
#include <asm/desc.h>
#include <asm/ptrace.h>
@@ -97,11 +98,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];
};
@@ -529,7 +528,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)
@@ -1269,7 +1268,12 @@ void __init xen_init_IRQ(void)
cpu_evtchn_mask_p = kcalloc(nr_cpu_ids, sizeof(struct cpu_evtchn_s),
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();
--
1.7.0.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] [PATCH 05/23] xen: identity map gsi->irqs, (continued)
- [Xen-devel] [PATCH 05/23] xen: identity map gsi->irqs, Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 08/23] xen: statically initialize cpu_evtchn_mask_p, Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 04/23] x86/io_apic: add get_nr_irqs_gsi(), Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 21/23] xen/pci: Request ACS when Xen-SWIOTLB is activated., Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 14/23] x86/PCI: Export pci_walk_bus function., Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 19/23] xenbus: prevent warnings on unhandled enumeration values, Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 01/23] xen: Don't disable the I/O space, Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 12/23] x86/PCI: Clean up pci_cache_line_size, Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 11/23] xen: fix shared irq device passthrough, Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 17/23] xen/x86/PCI: Add support for the Xen PCI subsystem, Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 06/23] xen: dynamically allocate irq & event structures,
Konrad Rzeszutek Wilk <=
- [Xen-devel] [PATCH 09/23] xen: Find an unbound irq number in reverse order (high to low)., Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 03/23] xen: implement pirq type event channels, Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 02/23] xen: define BIOVEC_PHYS_MERGEABLE(), Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 22/23] MAINTAINERS: Add myself for Xen PCI and Xen SWIOTLB maintainer., Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 10/23] xen: Provide a variant of xen_poll_irq with timeout., Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 23/23] swiotlb-xen: On x86-32 builts, select SWIOTLB instead of depending on it., Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 15/23] msi: Introduce default_[teardown|setup]_msi_irqs with fallback., Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 16/23] x86: Introduce x86_msi_ops, Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 20/23] xen-pcifront: Xen PCI frontend driver., Konrad Rzeszutek Wilk
|
|
|