diff options
author | Yinghai Lu <yinghai@kernel.org> | 2009-02-08 16:18:03 -0800 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-09 09:02:34 +0100 |
commit | 005bf0e6fa0e9543933fe2e36322af649df7cacb (patch) | |
tree | b14afa63f043d8c1fcf705b2d60262d873ec8f3f /kernel/irq/handle.c | |
parent | 0f3c2a89c1451cdf6328f99977bd9decd4f708e1 (diff) | |
download | op-kernel-dev-005bf0e6fa0e9543933fe2e36322af649df7cacb.zip op-kernel-dev-005bf0e6fa0e9543933fe2e36322af649df7cacb.tar.gz |
irq: optimize init_kstat_irqs/init_copy_kstat_irqs
Simplify and make init_kstat_irqs etc more type proof, suggested by
Andrew.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/irq/handle.c')
-rw-r--r-- | kernel/irq/handle.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 1b473e7..49d642b 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c @@ -71,19 +71,21 @@ static struct irq_desc irq_desc_init = { void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr) { - unsigned long bytes; - char *ptr; int node; - - /* Compute how many bytes we need per irq and allocate them */ - bytes = nr * sizeof(unsigned int); + void *ptr; node = cpu_to_node(cpu); - ptr = kzalloc_node(bytes, GFP_ATOMIC, node); - printk(KERN_DEBUG " alloc kstat_irqs on cpu %d node %d\n", cpu, node); + ptr = kzalloc_node(nr * sizeof(*desc->kstat_irqs), GFP_ATOMIC, node); - if (ptr) - desc->kstat_irqs = (unsigned int *)ptr; + /* + * don't overwite if can not get new one + * init_copy_kstat_irqs() could still use old one + */ + if (ptr) { + printk(KERN_DEBUG " alloc kstat_irqs on cpu %d node %d\n", + cpu, node); + desc->kstat_irqs = ptr; + } } static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu) |