public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Shaohua Li <shli@kernel.org>
To: linux-kernel@vger.kernel.org, axboe@kernel.dk
Subject: [PATCH] blk-mq: cache rq->q
Date: Fri, 11 Oct 2013 12:11:05 +0800	[thread overview]
Message-ID: <20131011041105.GA1692@kernel.org> (raw)


If a tag is freed, the request might be used very soon. There is a short window
rq->q is null, so cache it.

Signed-off-by: Shaohua Li <shli@fusionio.com>
---
 block/blk-mq.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: master/block/blk-mq.c
===================================================================
--- master.orig/block/blk-mq.c	2013-10-11 12:07:32.282133638 +0800
+++ master/block/blk-mq.c	2013-10-11 12:07:32.282133638 +0800
@@ -250,11 +250,12 @@ static void __blk_mq_free_request(struct
 				  struct blk_mq_ctx *ctx, struct request *rq)
 {
 	const int tag = rq->tag;
+	struct request_queue *q = rq->q;
 
 	blk_mq_rq_init(hctx, rq);
 	blk_mq_put_tag(hctx->tags, tag);
 
-	blk_mq_queue_exit(rq->q);
+	blk_mq_queue_exit(q);
 }
 
 void blk_mq_free_request(struct request *rq)

             reply	other threads:[~2013-10-11  4:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11  4:11 Shaohua Li [this message]
2013-10-11 14:25 ` [PATCH] blk-mq: cache rq->q Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131011041105.GA1692@kernel.org \
    --to=shli@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox