Skip to contentSkip to conversation

-mm: make noirqdebug/irqfixup __read_mostly, add (un)likely()

PATCH New Andreas Mohr 1 participant 1 message Apr 21, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 -mm: make noirqdebug/irqfixup __read_mostly, add (un)likely()

Hello all,

"noirqdebug" is checked in main IRQ handler, thus __read_mostly is useful. Threw in an additional __read_mostly for "irqfixup" (that codepath is enabled by default, too, thus also useful).
Add some (un)likely() in the hot paths of spurious IRQ detection code.

Patch compiled and tested on 2.6.17-rc1-mm3.
I did not test the arm part, though, for obvious reasons.

Those were the boring things, somewhat more interesting ones coming soon.

Thanks!

kernel/irq/spurious.c +4 -4
@@ -11,7 +11,7 @@
 #include <linux/kallsyms.h>
 #include <linux/interrupt.h>
 
-static int irqfixup;
+static int irqfixup __read_mostly;
 
 /*
  * Recovery handler for misrouted interrupts.
@@ -138,7 +138,7 @@
 {
 	if (action_ret != IRQ_HANDLED) {
 		desc->irqs_unhandled++;
-		if (action_ret != IRQ_NONE)
+		if (unlikely(action_ret != IRQ_NONE))
 			report_bad_irq(irq, desc, action_ret);
 	}
 
@@ -152,7 +152,7 @@
 	}
 
 	desc->irq_count++;
-	if (desc->irq_count < 100000)
+	if (likely(desc->irq_count < 100000))
 		return;
 
 	desc->irq_count = 0;
@@ -171,7 +171,7 @@
 	desc->irqs_unhandled = 0;
 }
 
-int noirqdebug;
+int noirqdebug __read_mostly;
 
 int __init noirqdebug_setup(char *str)
 {
arch/arm/kernel/irq.c +2 -2
@@ -52,7 +52,7 @@
  */
 #define MAX_IRQ_CNT	100000
 
-static int noirqdebug;
+static int noirqdebug __read_mostly;
 static volatile unsigned long irq_err_count;
 static DEFINE_SPINLOCK(irq_controller_lock);
 static LIST_HEAD(irq_pending);
@@ -81,7 +81,7 @@
 
 void do_bad_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
 {
-	irq_err_count += 1;
+	irq_err_count++;
 	printk(KERN_ERR "IRQ: spurious interrupt %d\n", irq);
 }