aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk.h
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2008-09-13 14:26:01 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 02:56:09 -0400
commitc7c22e4d5c1fdebfac4dba76de7d0338c2b0d832 (patch)
treeecc3d2517b3471ccc35d4cb4e3b48d4b57205061 /block/blk.h
parent18887ad910e56066233a07fd3cfb2fa11338b782 (diff)
block: add support for IO CPU affinity
This patch adds support for controlling the IO completion CPU of either all requests on a queue, or on a per-request basis. We export a sysfs variable (rq_affinity) which, if set, migrates completions of requests to the CPU that originally submitted it. A bio helper (bio_set_completion_cpu()) is also added, so that queuers can ask for completion on that specific CPU. In testing, this has been show to cut the system time by as much as 20-40% on synthetic workloads where CPU affinity is desired. This requires a little help from the architecture, so it'll only work as designed for archs that are using the new generic smp helper infrastructure. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/blk.h')
-rw-r--r--block/blk.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/block/blk.h b/block/blk.h
index c79f30e1df52..de74254cb916 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -59,4 +59,16 @@ static inline int queue_congestion_off_threshold(struct request_queue *q)
59 59
60#endif /* BLK_DEV_INTEGRITY */ 60#endif /* BLK_DEV_INTEGRITY */
61 61
62static inline int blk_cpu_to_group(int cpu)
63{
64#ifdef CONFIG_SCHED_MC
65 cpumask_t mask = cpu_coregroup_map(cpu);
66 return first_cpu(mask);
67#elif defined(CONFIG_SCHED_SMT)
68 return first_cpu(per_cpu(cpu_sibling_map, cpu));
69#else
70 return cpu;
71#endif
72}
73
62#endif 74#endif