i386: speedup touch_nmi_watchdog
authorAndrew Morton <akpm@linux-foundation.org>
Tue, 17 Jul 2007 11:03:57 +0000 (04:03 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 17 Jul 2007 17:23:04 +0000 (10:23 -0700)
Avoid dirtying remote cpu's memory if it already has the correct value.

Cc: Andi Kleen <ak@suse.de>
Cc: Konrad Rzeszutek <konrad@darnok.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/i386/kernel/nmi.c

index fba121f..03b7f55 100644 (file)
@@ -295,7 +295,7 @@ static unsigned int
        last_irq_sums [NR_CPUS],
        alert_counter [NR_CPUS];
 
-void touch_nmi_watchdog (void)
+void touch_nmi_watchdog(void)
 {
        if (nmi_watchdog > 0) {
                unsigned cpu;
@@ -304,8 +304,10 @@ void touch_nmi_watchdog (void)
                 * Just reset the alert counters, (other CPUs might be
                 * spinning on locks we hold):
                 */
-               for_each_present_cpu (cpu)
-                       alert_counter[cpu] = 0;
+               for_each_present_cpu(cpu) {
+                       if (alert_counter[cpu])
+                               alert_counter[cpu] = 0;
+               }
        }
 
        /*