]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] NUMA-Q disable irqbalance
authorDave Hansen <haveblue@us.ibm.com>
Mon, 19 Aug 2002 11:07:40 +0000 (04:07 -0700)
committerOleg Drokin <green@angband.namesys.com>
Mon, 19 Aug 2002 11:07:40 +0000 (04:07 -0700)
Here's a patch from Andrea's tree that uses IRQ_BALANCE_INTERVAL to
define how often interrupts are balanced, staying independent from HZ.

  It also makes sure that there _is_ a change to the configuration
before it actually writes it.  It reminds me of the mod_timer
optimization.

arch/i386/kernel/io_apic.c

index fdea2bd53f9b958dc68584ed5a84287fd7bc3678..ed8a1f9275f61bc57b91496d109c63035332e54a 100644 (file)
@@ -220,6 +220,9 @@ extern unsigned long irq_affinity [NR_IRQS];
                ((1 << cpu) & (allowed_mask))
 
 #if CONFIG_SMP
+
+#define IRQ_BALANCE_INTERVAL (HZ/50)
+       
 static unsigned long move(int curr_cpu, unsigned long allowed_mask, unsigned long now, int direction)
 {
        int search_idle = 1;
@@ -254,8 +257,9 @@ static inline void balance_irq(int irq)
        if (clustered_apic_mode)
                return;
 
-       if (entry->timestamp != now) {
+       if (unlikely(time_after(now, entry->timestamp + IRQ_BALANCE_INTERVAL))) {
                unsigned long allowed_mask;
+               unsigned int new_cpu;
                int random_number;
 
                rdtscl(random_number);
@@ -263,8 +267,11 @@ static inline void balance_irq(int irq)
 
                allowed_mask = cpu_online_map & irq_affinity[irq];
                entry->timestamp = now;
-               entry->cpu = move(entry->cpu, allowed_mask, now, random_number);
-               set_ioapic_affinity(irq, 1 << entry->cpu);
+               new_cpu = move(entry->cpu, allowed_mask, now, random_number);
+               if (entry->cpu != new_cpu) {
+                       entry->cpu = new_cpu;
+                       set_ioapic_affinity(irq, 1 << new_cpu);
+               }
        }
 }
 #else /* !SMP */