提交 88c7b2b7 编写于 作者: J Jens Axboe

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: NJens Axboe <axboe@fb.com>
上级 8d354f13
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/sched/sysctl.h> #include <linux/sched/sysctl.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/crash_dump.h> #include <linux/crash_dump.h>
#include <linux/prefetch.h>
#include <trace/events/block.h> #include <trace/events/block.h>
...@@ -588,8 +589,10 @@ EXPORT_SYMBOL(blk_mq_abort_requeue_list); ...@@ -588,8 +589,10 @@ EXPORT_SYMBOL(blk_mq_abort_requeue_list);
struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag) struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag)
{ {
if (tag < tags->nr_tags) if (tag < tags->nr_tags) {
prefetch(tags->rqs[tag]);
return tags->rqs[tag]; return tags->rqs[tag];
}
return NULL; return NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册