From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org,
Christoph Hellwig <hch@infradead.org>,
Mike Snitzer <snitzer@redhat.com>
Cc: dm-devel@redhat.com, Laurence Oberman <loberman@redhat.com>,
Bart Van Assche <bart.vanassche@sandisk.com>
Subject: Re: [PATCH 4/5] blk-mq: introduce blk_get_request_notify
Date: Mon, 22 Jan 2018 18:19:03 +0800 [thread overview]
Message-ID: <20180122101902.GD1570@ming.t460p> (raw)
In-Reply-To: <20180122033550.27855-5-ming.lei@redhat.com>
On Mon, Jan 22, 2018 at 11:35:49AM +0800, Ming Lei wrote:
> DM-MPATH need to allocate request from underlying queue, but when the
> allocation fails, there is no way to make underlying queue's RESTART
> to restart DM's queue.
>
> This patch introduces blk_get_request_notify() for this purpose, and
> caller need to pass 'wait_queue_entry_t' to this function, and make
> sure it is initialized well, so after the current allocation fails,
> DM will get notified when there is request available from underlying
> queue.
>
> This approach is suggested by Jens, and has been used in blk-mq dispatch
> patch for a while, see blk_mq_mark_tag_wait().
>
> Suggested-by: Jens Axboe <axboe@kernel.dk>
> Cc: Mike Snitzer <snitzer@redhat.com>
> Cc: Laurence Oberman <loberman@redhat.com>
> Cc: Bart Van Assche <bart.vanassche@sandisk.com>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
> block/blk-mq-tag.c | 27 ++++++++++++++++++++++++++-
> block/blk-mq.c | 24 +++++++++++++++++++++---
> block/blk-mq.h | 1 +
> include/linux/blk-mq.h | 5 +++++
> 4 files changed, 53 insertions(+), 4 deletions(-)
>
> diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
> index 336dde07b230..911fc9bd1bab 100644
> --- a/block/blk-mq-tag.c
> +++ b/block/blk-mq-tag.c
> @@ -128,10 +128,35 @@ unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data)
> if (tag != -1)
> goto found_tag;
>
> - if (data->flags & BLK_MQ_REQ_NOWAIT)
> + if ((data->flags & BLK_MQ_REQ_NOWAIT) && !(data->notifier &&
> + (data->flags & BLK_MQ_REQ_ALLOC_NOTIFY)))
> return BLK_MQ_TAG_FAIL;
>
> ws = bt_wait_ptr(bt, data->hctx);
> +
> + /*
> + * If caller requires notification when tag is available, add
> + * wait entry of 'data->notifier' to the wait queue.
> + */
> + if (data->flags & BLK_MQ_REQ_NOWAIT) {
> + bool added = false;
> +
> + spin_lock_irq(&ws->wait.lock);
> + if (list_empty(&data->notifier->entry))
> + __add_wait_queue(&ws->wait, data->notifier);
> + else
> + added = true;
> + spin_unlock_irq(&ws->wait.lock);
The above need a per-notifier lock too, since the same notifier may
be added to different wait queues at the same time.
--
Ming
next prev parent reply other threads:[~2018-01-22 10:19 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 3:35 [PATCH 0/5] blk-mq & dm: fix IO hang and deal with one performance issue Ming Lei
2018-01-22 3:35 ` [PATCH 1/5] blk-mq: introduce BLK_STS_DEV_RESOURCE Ming Lei
2018-01-22 16:32 ` Christoph Hellwig
2018-01-22 16:49 ` Bart Van Assche
2018-01-23 0:57 ` Ming Lei
2018-01-23 16:17 ` Bart Van Assche
2018-01-23 16:26 ` Ming Lei
2018-01-23 16:37 ` Bart Van Assche
2018-01-23 16:41 ` Ming Lei
2018-01-23 16:47 ` Bart Van Assche
2018-01-23 16:49 ` Ming Lei
2018-01-23 16:54 ` Bart Van Assche
2018-01-23 16:59 ` Ming Lei
2018-01-23 22:01 ` Bart Van Assche
2018-01-24 2:31 ` Ming Lei
2018-01-22 3:35 ` [PATCH 2/5] dm-rq: handle dispatch exception in dm_dispatch_clone_request() Ming Lei
2018-01-22 3:35 ` [PATCH 3/5] dm-rq: return BLK_STS_* from map_request() Ming Lei
2018-01-22 5:35 ` Ming Lei
2018-01-22 3:35 ` [PATCH 4/5] blk-mq: introduce blk_get_request_notify Ming Lei
2018-01-22 10:19 ` Ming Lei [this message]
2018-01-22 17:13 ` Bart Van Assche
2018-01-23 1:29 ` Ming Lei
2018-01-22 3:35 ` [PATCH 5/5] dm-mpath: use blk_mq_alloc_request_notify for allocating blk-mq req Ming Lei
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=20180122101902.GD1570@ming.t460p \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=bart.vanassche@sandisk.com \
--cc=dm-devel@redhat.com \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=loberman@redhat.com \
--cc=snitzer@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).