linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@fb.com>
To: <linux-block@vger.kernel.org>
Cc: <ming.lei@redhat.com>, <hch@lst.de>, Jens Axboe <axboe@fb.com>
Subject: [PATCH 4/6] blk-mq: don't bypass scheduler for reserved requests
Date: Thu, 27 Apr 2017 16:51:32 -0600	[thread overview]
Message-ID: <1493333494-600-5-git-send-email-axboe@fb.com> (raw)
In-Reply-To: <1493333494-600-1-git-send-email-axboe@fb.com>

Instead of bypassing the scheduler for insertion of reserved requests,
we ensure that the request is marked as RQF_RESERVED so they driver
knows where it came from.

Usually we just use the tag to know if it's reserved or not,
but that only works when the request has a driver tag assigned.
Using RQF_RESERVED can be done independently of whether or not
scheduling is used.

Signed-off-by: Jens Axboe <axboe@fb.com>
---
 block/blk-mq-sched.c   | 8 +++-----
 block/blk-mq.c         | 3 +++
 include/linux/blkdev.h | 2 ++
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index 8b361e192e8a..27c67465f856 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -82,11 +82,7 @@ struct request *blk_mq_sched_get_request(struct request_queue *q,
 	if (likely(!data->hctx))
 		data->hctx = blk_mq_map_queue(q, data->ctx->cpu);
 
-	/*
-	 * For a reserved tag, allocate a normal request since we might
-	 * have driver dependencies on the value of the internal tag.
-	 */
-	if (e && !(data->flags & BLK_MQ_REQ_RESERVED)) {
+	if (e) {
 		data->flags |= BLK_MQ_REQ_INTERNAL;
 
 		/*
@@ -104,6 +100,8 @@ struct request *blk_mq_sched_get_request(struct request_queue *q,
 	}
 
 	if (rq) {
+		if (data->flags & BLK_MQ_REQ_RESERVED)
+			rq->rq_flags |= RQF_RESERVED;
 		if (!op_is_flush(op)) {
 			rq->elv.icq = NULL;
 			if (e && e->type->icq_cache)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index b75ef2392db7..0168b27469cb 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -268,6 +268,9 @@ struct request *__blk_mq_alloc_request(struct blk_mq_alloc_data *data,
 			data->hctx->tags->rqs[rq->tag] = rq;
 		}
 
+		if (data->flags & BLK_MQ_REQ_RESERVED)
+			rq->rq_flags |= RQF_RESERVED;
+
 		blk_mq_rq_ctx_init(data->q, data->ctx, rq, op);
 		return rq;
 	}
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index ba3884f26288..c246de5861dc 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -120,6 +120,8 @@ typedef __u32 __bitwise req_flags_t;
 /* Look at ->special_vec for the actual data payload instead of the
    bio chain. */
 #define RQF_SPECIAL_PAYLOAD	((__force req_flags_t)(1 << 18))
+/* Request came from the reserved tags/pool */
+#define RQF_RESERVED		((__force req_flags_t)(1 << 19))
 
 /* flags that prevent us from merging requests: */
 #define RQF_NOMERGE_FLAGS \
-- 
2.7.4

  parent reply	other threads:[~2017-04-27 22:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-27 22:51 [PATCH 0/6] Fixup mtip32xx for scheduling Jens Axboe
2017-04-27 22:51 ` [PATCH 1/6] mtip32xx: get rid of 'atomic' argument to mtip_exec_internal_command() Jens Axboe
2017-04-27 23:19   ` Bart Van Assche
2017-04-27 22:51 ` [PATCH 2/6] mtip32xx: kill atomic argument to mtip_quiesce_io() Jens Axboe
2017-04-27 23:20   ` Bart Van Assche
2017-04-27 22:51 ` [PATCH 3/6] mtip32xx: abstract out "are any commands active" helper Jens Axboe
2017-04-27 23:21   ` Bart Van Assche
2017-04-27 22:51 ` Jens Axboe [this message]
2017-04-28  4:04   ` [PATCH 4/6] blk-mq: don't bypass scheduler for reserved requests Ming Lei
2017-04-28  4:13     ` Jens Axboe
2017-04-27 22:51 ` [PATCH 5/6] mtip32xx: convert internal command issue to block IO path Jens Axboe
2017-04-27 23:29   ` Bart Van Assche
2017-04-27 23:35     ` Jens Axboe
2017-04-27 22:51 ` [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" Jens Axboe
2017-04-28  4:06   ` Ming Lei
2017-04-27 23:12 ` [PATCH 0/6] Fixup mtip32xx for scheduling Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2017-04-28 14:01 [PATCH v2 " Jens Axboe
2017-04-28 14:01 ` [PATCH 4/6] blk-mq: don't bypass scheduler for reserved requests Jens Axboe
2017-04-28 14:31 [PATCH v2a 0/6]: Fixup mtip32xx for scheduling Jens Axboe
2017-04-28 14:31 ` [PATCH 4/6] blk-mq: don't bypass scheduler for reserved requests Jens Axboe
2017-04-28 14:41   ` Christoph Hellwig
2017-04-28 14:45     ` 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=1493333494-600-5-git-send-email-axboe@fb.com \
    --to=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).