From: Omar Sandoval <osandov@osandov.com>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, Andrew Jones <drjones@redhat.com>,
Christoph Hellwig <hch@lst.de>, Omar Sandoval <osandov@fb.com>,
Bart Van Assche <bart.vanassche@wdc.com>
Subject: Re: [PATCH 2/5] blk-mq: don't pass **hctx to blk_mq_mark_tag_wait()
Date: Tue, 26 Jun 2018 14:12:08 -0700 [thread overview]
Message-ID: <20180626211208.GI1218@vader> (raw)
In-Reply-To: <20180625113149.29449-3-ming.lei@redhat.com>
On Mon, Jun 25, 2018 at 07:31:46PM +0800, Ming Lei wrote:
> 'hctx' won't be changed at all, so not necessary to pass
> '**hctx' to blk_mq_mark_tag_wait().
>
> Cc: Andrew Jones <drjones@redhat.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Omar Sandoval <osandov@fb.com>
> Cc: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Omar Sandoval <osandov@fb.com>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
> block/blk-mq.c | 23 +++++++++++------------
> 1 file changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 62e153eb720c..db2814eb050f 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -1009,17 +1009,16 @@ static int blk_mq_dispatch_wake(wait_queue_entry_t *wait, unsigned mode,
> * restart. For both cases, take care to check the condition again after
> * marking us as waiting.
> */
> -static bool blk_mq_mark_tag_wait(struct blk_mq_hw_ctx **hctx,
> +static bool blk_mq_mark_tag_wait(struct blk_mq_hw_ctx *hctx,
> struct request *rq)
> {
> - struct blk_mq_hw_ctx *this_hctx = *hctx;
> struct sbq_wait_state *ws;
> wait_queue_entry_t *wait;
> bool ret;
>
> - if (!(this_hctx->flags & BLK_MQ_F_TAG_SHARED)) {
> - if (!test_bit(BLK_MQ_S_SCHED_RESTART, &this_hctx->state))
> - set_bit(BLK_MQ_S_SCHED_RESTART, &this_hctx->state);
> + if (!(hctx->flags & BLK_MQ_F_TAG_SHARED)) {
> + if (!test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state))
> + set_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state);
>
> /*
> * It's possible that a tag was freed in the window between the
> @@ -1032,17 +1031,17 @@ static bool blk_mq_mark_tag_wait(struct blk_mq_hw_ctx **hctx,
> return blk_mq_get_driver_tag(rq);
> }
>
> - wait = &this_hctx->dispatch_wait;
> + wait = &hctx->dispatch_wait;
> if (!list_empty_careful(&wait->entry))
> return false;
>
> - spin_lock(&this_hctx->lock);
> + spin_lock(&hctx->lock);
> if (!list_empty(&wait->entry)) {
> - spin_unlock(&this_hctx->lock);
> + spin_unlock(&hctx->lock);
> return false;
> }
>
> - ws = bt_wait_ptr(&this_hctx->tags->bitmap_tags, this_hctx);
> + ws = bt_wait_ptr(&hctx->tags->bitmap_tags, hctx);
> add_wait_queue(&ws->wait, wait);
>
> /*
> @@ -1052,7 +1051,7 @@ static bool blk_mq_mark_tag_wait(struct blk_mq_hw_ctx **hctx,
> */
> ret = blk_mq_get_driver_tag(rq);
> if (!ret) {
> - spin_unlock(&this_hctx->lock);
> + spin_unlock(&hctx->lock);
> return false;
> }
>
> @@ -1063,7 +1062,7 @@ static bool blk_mq_mark_tag_wait(struct blk_mq_hw_ctx **hctx,
> spin_lock_irq(&ws->wait.lock);
> list_del_init(&wait->entry);
> spin_unlock_irq(&ws->wait.lock);
> - spin_unlock(&this_hctx->lock);
> + spin_unlock(&hctx->lock);
>
> return true;
> }
> @@ -1105,7 +1104,7 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list,
> * before we add this entry back on the dispatch list,
> * we'll re-run it below.
> */
> - if (!blk_mq_mark_tag_wait(&hctx, rq)) {
> + if (!blk_mq_mark_tag_wait(hctx, rq)) {
> blk_mq_put_dispatch_budget(hctx);
> /*
> * For non-shared tags, the RESTART check
> --
> 2.9.5
>
next prev parent reply other threads:[~2018-06-26 21:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-25 11:31 [PATCH 0/5] blk-mq: dispatch related cleanup, fix and optimization Ming Lei
2018-06-25 11:31 ` [PATCH 1/5] blk-mq: cleanup blk_mq_get_driver_tag() Ming Lei
2018-06-26 21:11 ` Omar Sandoval
2018-06-25 11:31 ` [PATCH 2/5] blk-mq: don't pass **hctx to blk_mq_mark_tag_wait() Ming Lei
2018-06-26 21:12 ` Omar Sandoval [this message]
2018-06-25 11:31 ` [PATCH 3/5] blk-mq: introduce new lock for protecting hctx->dispatch_wait Ming Lei
2018-06-25 11:31 ` [PATCH 4/5] blk-mq: remove synchronize_rcu() from blk_mq_del_queue_tag_set() Ming Lei
2018-06-25 11:31 ` [PATCH 5/5] blk-mq: avoid to synchronize rcu inside blk_cleanup_queue() Ming Lei
2018-06-25 15:23 ` [PATCH 0/5] blk-mq: dispatch related cleanup, fix and optimization Andrew Jones
2018-06-28 19:21 ` 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=20180626211208.GI1218@vader \
--to=osandov@osandov.com \
--cc=axboe@kernel.dk \
--cc=bart.vanassche@wdc.com \
--cc=drjones@redhat.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=osandov@fb.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