Commit 00b42959106a9ca1c2899e591ae4e9a83ad6af05

Authored by Frederic Weisbecker
1 parent 33a5f6261a

irq_work: Don't stop the tick with pending works

Don't stop the tick if we have pending irq works on the
queue, otherwise if the arch can't raise self-IPIs, we may not
find an opportunity to execute the pending works for a while.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>

Showing 3 changed files with 19 additions and 1 deletions Side-by-side Diff

include/linux/irq_work.h
... ... @@ -20,5 +20,11 @@
20 20 void irq_work_run(void);
21 21 void irq_work_sync(struct irq_work *work);
22 22  
  23 +#ifdef CONFIG_IRQ_WORK
  24 +bool irq_work_needs_cpu(void);
  25 +#else
  26 +static bool irq_work_needs_cpu(void) { return false; }
  27 +#endif
  28 +
23 29 #endif /* _LINUX_IRQ_WORK_H */
... ... @@ -99,6 +99,17 @@
99 99 }
100 100 EXPORT_SYMBOL_GPL(irq_work_queue);
101 101  
  102 +bool irq_work_needs_cpu(void)
  103 +{
  104 + struct llist_head *this_list;
  105 +
  106 + this_list = &__get_cpu_var(irq_work_list);
  107 + if (llist_empty(this_list))
  108 + return false;
  109 +
  110 + return true;
  111 +}
  112 +
102 113 /*
103 114 * Run the irq_work entries on this cpu. Requires to be ran from hardirq
104 115 * context with local IRQs disabled.
kernel/time/tick-sched.c
... ... @@ -20,6 +20,7 @@
20 20 #include <linux/profile.h>
21 21 #include <linux/sched.h>
22 22 #include <linux/module.h>
  23 +#include <linux/irq_work.h>
23 24  
24 25 #include <asm/irq_regs.h>
25 26  
... ... @@ -289,7 +290,7 @@
289 290 } while (read_seqretry(&xtime_lock, seq));
290 291  
291 292 if (rcu_needs_cpu(cpu, &rcu_delta_jiffies) || printk_needs_cpu(cpu) ||
292   - arch_needs_cpu(cpu)) {
  293 + arch_needs_cpu(cpu) || irq_work_needs_cpu()) {
293 294 next_jiffies = last_jiffies + 1;
294 295 delta_jiffies = 1;
295 296 } else {