From: Jens Axboe Date: Thu, 25 Aug 2016 14:07:30 +0000 (-0600) Subject: blk-mq: prefetch request in blk_mq_tag_to_rq() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=88c7b2b75132c3ff8180b71e4f06cf043a00eac8;p=linux-beck.git 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 --- 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 @@ #include #include #include +#include #include @@ -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) { - if (tag < tags->nr_tags) + if (tag < tags->nr_tags) { + prefetch(tags->rqs[tag]); return tags->rqs[tag]; + } return NULL; }