linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Douglas Anderson <dianders@chromium.org>
To: axboe@kernel.dk, jejb@linux.ibm.com, martin.petersen@oracle.com
Cc: paolo.valente@linaro.org, groeck@chromium.org,
	"Gwendal Grignou" <gwendal@chromium.org>,
	linux-scsi@vger.kernel.org, linux-block@vger.kernel.org,
	"Ming Lei" <ming.lei@redhat.com>,
	sqazi@google.com, "Douglas Anderson" <dianders@chromium.org>,
	"André Almeida" <andrealmeid@collabora.com>,
	"Bart Van Assche" <bvanassche@acm.org>,
	"Damien Le Moal" <damien.lemoal@wdc.com>,
	"John Garry" <john.garry@huawei.com>,
	"Pavel Begunkov" <asml.silence@gmail.com>,
	"Sagi Grimberg" <sagi@grimberg.me>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v4 2/4] blk-mq: Add blk_mq_delay_run_hw_queues() API call
Date: Wed,  8 Apr 2020 08:04:00 -0700	[thread overview]
Message-ID: <20200408080255.v4.2.I4c665d70212a5b33e103fec4d5019a59b4c05577@changeid> (raw)
In-Reply-To: <20200408150402.21208-1-dianders@chromium.org>

We have:
* blk_mq_run_hw_queue()
* blk_mq_delay_run_hw_queue()
* blk_mq_run_hw_queues()

...but not blk_mq_delay_run_hw_queues(), presumably because nobody
needed it before now.  Since we need it for a later patch in this
series, add it.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

Changes in v4: None
Changes in v3:
- ("blk-mq: Add blk_mq_delay_run_hw_queues() API call") new for v3

Changes in v2: None

 block/blk-mq.c         | 19 +++++++++++++++++++
 include/linux/blk-mq.h |  1 +
 2 files changed, 20 insertions(+)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 2cd8d2b49ff4..ea0cd970a3ff 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1537,6 +1537,25 @@ void blk_mq_run_hw_queues(struct request_queue *q, bool async)
 }
 EXPORT_SYMBOL(blk_mq_run_hw_queues);
 
+/**
+ * blk_mq_delay_run_hw_queues - Run all hardware queues asynchronously.
+ * @q: Pointer to the request queue to run.
+ * @msecs: Microseconds of delay to wait before running the queues.
+ */
+void blk_mq_delay_run_hw_queues(struct request_queue *q, unsigned long msecs)
+{
+	struct blk_mq_hw_ctx *hctx;
+	int i;
+
+	queue_for_each_hw_ctx(q, hctx, i) {
+		if (blk_mq_hctx_stopped(hctx))
+			continue;
+
+		blk_mq_delay_run_hw_queue(hctx, msecs);
+	}
+}
+EXPORT_SYMBOL(blk_mq_delay_run_hw_queues);
+
 /**
  * blk_mq_queue_stopped() - check whether one or more hctxs have been stopped
  * @q: request queue.
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 11cfd6470b1a..405f8c196517 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -503,6 +503,7 @@ void blk_mq_unquiesce_queue(struct request_queue *q);
 void blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs);
 void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async);
 void blk_mq_run_hw_queues(struct request_queue *q, bool async);
+void blk_mq_delay_run_hw_queues(struct request_queue *q, unsigned long msecs);
 void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset,
 		busy_tag_iter_fn *fn, void *priv);
 void blk_mq_tagset_wait_completed_request(struct blk_mq_tag_set *tagset);
-- 
2.26.0.292.g33ef6b2f38-goog


  parent reply	other threads:[~2020-04-08 15:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08 15:03 [PATCH v4 0/4] blk-mq: Fix two causes of IO stalls found in reboot testing Douglas Anderson
2020-04-08 15:03 ` [PATCH v4 1/4] blk-mq: In blk_mq_dispatch_rq_list() "no budget" is a reason to kick Douglas Anderson
2020-04-08 15:04 ` Douglas Anderson [this message]
2020-04-09  1:13   ` [PATCH v4 2/4] blk-mq: Add blk_mq_delay_run_hw_queues() API call Ming Lei
2020-04-08 15:04 ` [PATCH v4 3/4] blk-mq: Rerun dispatching in the case of budget contention Douglas Anderson
2020-04-09  1:13   ` Ming Lei
2020-04-08 15:04 ` [PATCH v4 4/4] Revert "scsi: core: run queue if SCSI device queue isn't ready and queue is idle" Douglas Anderson
2020-04-09  1:24   ` Ming Lei
2020-04-13 17:51   ` Martin K. Petersen
2020-04-20 14:45 ` [PATCH v4 0/4] blk-mq: Fix two causes of IO stalls found in reboot testing Doug Anderson
2020-04-20 15:49   ` Jens Axboe
2020-04-20 16:31     ` Doug Anderson

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=20200408080255.v4.2.I4c665d70212a5b33e103fec4d5019a59b4c05577@changeid \
    --to=dianders@chromium.org \
    --cc=andrealmeid@collabora.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=damien.lemoal@wdc.com \
    --cc=groeck@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=jejb@linux.ibm.com \
    --cc=john.garry@huawei.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@redhat.com \
    --cc=paolo.valente@linaro.org \
    --cc=sagi@grimberg.me \
    --cc=sqazi@google.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).