[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2 of 3] IRQ: Fold irq_status into irq_cfg
irq_status is an int for each of nr_irqs which represents a single boolean variable. Fold it into the bitfield in irq_cfg, which saves 768 bytes per CPU with per-cpu IDTs in use. Signed-off-by Andrew Cooper <andrew.cooper3@xxxxxxxxxx> diff -r 5a1826139750 -r cf93a1825d66 xen/arch/x86/irq.c --- a/xen/arch/x86/irq.c Fri Sep 02 17:33:17 2011 +0100 +++ b/xen/arch/x86/irq.c Fri Sep 02 17:33:17 2011 +0100 @@ -39,11 +39,6 @@ boolean_param("irq-perdev-vector-map", o u8 __read_mostly *irq_vector; struct irq_desc __read_mostly *irq_desc = NULL; -int __read_mostly *irq_status = NULL; -#define IRQ_UNUSED (0) -#define IRQ_USED (1) -#define IRQ_RSVD (2) - #define IRQ_VECTOR_UNASSIGNED (0) static DECLARE_BITMAP(used_vectors, NR_VECTORS); @@ -117,7 +112,7 @@ static int __init __bind_irq_vector(int ASSERT(!test_bit(vector, cfg->used_vectors)); set_bit(vector, cfg->used_vectors); } - irq_status[irq] = IRQ_USED; + cfg->used = IRQ_USED; if (IO_APIC_IRQ(irq)) irq_vector[irq] = vector; return 0; @@ -139,7 +134,7 @@ static inline int find_unassigned_irq(vo int irq; for (irq = nr_irqs_gsi; irq < nr_irqs; irq++) - if (irq_status[irq] == IRQ_UNUSED) + if (irq_cfg[irq].used == IRQ_UNUSED) return irq; return -ENOSPC; } @@ -191,8 +186,6 @@ static void dynamic_irq_cleanup(unsigned xfree(action); } -static void init_one_irq_status(int irq); - static void __clear_irq_vector(int irq) { int cpu, vector; @@ -211,7 +204,7 @@ static void __clear_irq_vector(int irq) cfg->vector = IRQ_VECTOR_UNASSIGNED; cpus_clear(cfg->cpu_mask); - init_one_irq_status(irq); + cfg->used = IRQ_UNUSED; if (likely(!cfg->move_in_progress)) return; @@ -283,17 +276,13 @@ static void __init init_one_irq_desc(str INIT_LIST_HEAD(&desc->rl_link); } -static void init_one_irq_status(int irq) -{ - irq_status[irq] = IRQ_UNUSED; -} - static void __init init_one_irq_cfg(struct irq_cfg *cfg) { cfg->vector = IRQ_VECTOR_UNASSIGNED; cpus_clear(cfg->cpu_mask); cpus_clear(cfg->old_cpu_mask); cfg->used_vectors = NULL; + cfg->used = IRQ_UNUSED; } int __init init_irq_data(void) @@ -307,15 +296,13 @@ int __init init_irq_data(void) irq_desc = xmalloc_array(struct irq_desc, nr_irqs); irq_cfg = xmalloc_array(struct irq_cfg, nr_irqs); - irq_status = xmalloc_array(int, nr_irqs); irq_vector = xmalloc_array(u8, nr_irqs_gsi); - if ( !irq_desc || !irq_cfg || !irq_status ||! irq_vector ) + if ( !irq_desc || !irq_cfg ||! irq_vector ) return -ENOMEM; memset(irq_desc, 0, nr_irqs * sizeof(*irq_desc)); memset(irq_cfg, 0, nr_irqs * sizeof(*irq_cfg)); - memset(irq_status, 0, nr_irqs * sizeof(*irq_status)); memset(irq_vector, 0, nr_irqs_gsi * sizeof(*irq_vector)); for (irq = 0; irq < nr_irqs; irq++) { @@ -325,7 +312,6 @@ int __init init_irq_data(void) desc->chip_data = cfg; init_one_irq_desc(desc); init_one_irq_cfg(cfg); - init_one_irq_status(irq); } /* Never allocate the hypercall vector or Linux/BSD fast-trap vector. */ @@ -444,7 +430,7 @@ next: set_bit(vector, cfg->used_vectors); } - irq_status[irq] = IRQ_USED; + cfg->used = IRQ_USED; if (IO_APIC_IRQ(irq)) irq_vector[irq] = vector; err = 0; diff -r 5a1826139750 -r cf93a1825d66 xen/include/asm-x86/irq.h --- a/xen/include/asm-x86/irq.h Fri Sep 02 17:33:17 2011 +0100 +++ b/xen/include/asm-x86/irq.h Fri Sep 02 17:33:17 2011 +0100 @@ -34,8 +34,13 @@ struct irq_cfg { unsigned move_cleanup_count; vmask_t *used_vectors; u8 move_in_progress : 1; + u8 used: 1; }; +/* For use with irq_cfg.used */ +#define IRQ_UNUSED (0) +#define IRQ_USED (1) + extern struct irq_cfg *irq_cfg; typedef int vector_irq_t[NR_VECTORS]; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |