ARM: tegra: ardbeg: set avg values for productized sensors
[linux-3.10.git] / block / blk-softirq.c
index ce0efc6..467c8de 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/blkdev.h>
 #include <linux/interrupt.h>
 #include <linux/cpu.h>
+#include <linux/sched.h>
 
 #include "blk.h"
 
@@ -64,7 +65,7 @@ static int raise_blk_irq(int cpu, struct request *rq)
                data->info = rq;
                data->flags = 0;
 
-               __smp_call_function_single(cpu, data);
+               __smp_call_function_single(cpu, data, 0);
                return 0;
        }
 
@@ -103,25 +104,35 @@ static struct notifier_block __cpuinitdata blk_cpu_notifier = {
 
 void __blk_complete_request(struct request *req)
 {
+       int ccpu, cpu;
        struct request_queue *q = req->q;
        unsigned long flags;
-       int ccpu, cpu, group_cpu;
+       bool shared = false;
 
        BUG_ON(!q->softirq_done_fn);
 
        local_irq_save(flags);
        cpu = smp_processor_id();
-       group_cpu = blk_cpu_to_group(cpu);
 
        /*
         * Select completion CPU
         */
-       if (test_bit(QUEUE_FLAG_SAME_COMP, &q->queue_flags) && req->cpu != -1)
+       if (req->cpu != -1) {
                ccpu = req->cpu;
-       else
+               if (!test_bit(QUEUE_FLAG_SAME_FORCE, &q->queue_flags))
+                       shared = cpus_share_cache(cpu, ccpu);
+       } else
                ccpu = cpu;
 
-       if (ccpu == cpu || ccpu == group_cpu) {
+       /*
+        * If current CPU and requested CPU share a cache, run the softirq on
+        * the current CPU. One might concern this is just like
+        * QUEUE_FLAG_SAME_FORCE, but actually not. blk_complete_request() is
+        * running in interrupt handler, and currently I/O controller doesn't
+        * support multiple interrupts, so current CPU is unique actually. This
+        * avoids IPI sending from current CPU to the first CPU of a group.
+        */
+       if (ccpu == cpu || shared) {
                struct list_head *list;
 do_local:
                list = &__get_cpu_var(blk_cpu_done);