summaryrefslogtreecommitdiffstats
path: root/block/blk-mq.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2016-08-25 10:07:30 -0400
committerJens Axboe <axboe@fb.com>2016-08-29 10:13:21 -0400
commit88c7b2b75132c3ff8180b71e4f06cf043a00eac8 (patch)
treefa40cb8073832b2321b3f28a3fd782c125364dfb /block/blk-mq.c
parent8d354f133e86dd03ea7885a91df398c55ff699ff (diff)
blk-mq: prefetch request in blk_mq_tag_to_rq()
When drivers or the core calls this function, they usually dereference the request shortly there after. Prefetch the first cache line. Profiling IO workloads shows that this is the most common cache miss on the block side of things. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r--block/blk-mq.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index b68fdcbe58f6..eea0d230faa1 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -22,6 +22,7 @@
22#include <linux/sched/sysctl.h> 22#include <linux/sched/sysctl.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/crash_dump.h> 24#include <linux/crash_dump.h>
25#include <linux/prefetch.h>
25 26
26#include <trace/events/block.h> 27#include <trace/events/block.h>
27 28
@@ -588,8 +589,10 @@ EXPORT_SYMBOL(blk_mq_abort_requeue_list);
588 589
589struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag) 590struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag)
590{ 591{
591 if (tag < tags->nr_tags) 592 if (tag < tags->nr_tags) {
593 prefetch(tags->rqs[tag]);
592 return tags->rqs[tag]; 594 return tags->rqs[tag];
595 }
593 596
594 return NULL; 597 return NULL;
595} 598}