x86/bugs: Drop one "mitigation" from dmesg
[pandora-kernel.git] / kernel / softirq.c
index 2c71d91..44bc103 100644 (file)
@@ -194,22 +194,28 @@ void local_bh_enable_ip(unsigned long ip)
 EXPORT_SYMBOL(local_bh_enable_ip);
 
 /*
- * We restart softirq processing MAX_SOFTIRQ_RESTART times,
- * and we fall back to softirqd after that.
+ * We restart softirq processing for at most MAX_SOFTIRQ_RESTART times,
+ * but break the loop if need_resched() is set or after 2 ms.
+ * The MAX_SOFTIRQ_TIME provides a nice upper bound in most cases, but in
+ * certain cases, such as stop_machine(), jiffies may cease to
+ * increment and so we need the MAX_SOFTIRQ_RESTART limit as
+ * well to make sure we eventually return from this method.
  *
- * This number has been established via experimentation.
+ * These limits have been established via experimentation.
  * The two things to balance is latency against fairness -
  * we want to handle softirqs as soon as possible, but they
  * should not be able to lock up the box.
  */
+#define MAX_SOFTIRQ_TIME  msecs_to_jiffies(2)
 #define MAX_SOFTIRQ_RESTART 10
 
 asmlinkage void __do_softirq(void)
 {
        struct softirq_action *h;
        __u32 pending;
-       int max_restart = MAX_SOFTIRQ_RESTART;
+       unsigned long end = jiffies + MAX_SOFTIRQ_TIME;
        int cpu;
+       int max_restart = MAX_SOFTIRQ_RESTART;
 
        pending = local_softirq_pending();
        account_system_vtime(current);
@@ -255,11 +261,13 @@ restart:
        local_irq_disable();
 
        pending = local_softirq_pending();
-       if (pending && --max_restart)
-               goto restart;
+       if (pending) {
+               if (time_before(jiffies, end) && !need_resched() &&
+                   --max_restart)
+                       goto restart;
 
-       if (pending)
                wakeup_softirqd();
+       }
 
        lockdep_softirq_exit();