linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays
@ 2018-01-19 16:58 Bart Van Assche
  2018-01-19 16:58 ` [PATCH 1/3] blk-mq: Rename blk_mq_request_direct_issue() into blk_mq_request_issue_directly() Bart Van Assche
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Bart Van Assche @ 2018-01-19 16:58 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Christoph Hellwig, Mike Snitzer, Ming Lei,
	Bart Van Assche

Hello Jens,

Earlier today it was agreed that a blk_mq_delay_run_hw_queue() call followed
by a blk_mq_run_hw_queue() call should result in an immediate queue run. Hence
this patch series. Please consider this patch series for kernel v4.16.

Thanks,

Bart.

Bart Van Assche (3):
  blk-mq: Rename blk_mq_request_direct_issue() into
    blk_mq_request_issue_directly()
  blk-mq: Avoid that blk_mq_delay_run_hw_queue() introduces unintended
    delays
  block: Remove kblockd_schedule_delayed_work{,_on}()

 block/blk-core.c       | 16 +---------------
 block/blk-mq.c         | 11 +++++------
 block/blk-mq.h         |  2 +-
 include/linux/blkdev.h |  2 --
 4 files changed, 7 insertions(+), 24 deletions(-)

-- 
2.15.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] blk-mq: Rename blk_mq_request_direct_issue() into blk_mq_request_issue_directly()
  2018-01-19 16:58 [PATCH 0/3] Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays Bart Van Assche
@ 2018-01-19 16:58 ` Bart Van Assche
  2018-01-19 17:20   ` Mike Snitzer
  2018-01-19 16:58 ` [PATCH 2/3] blk-mq: Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays Bart Van Assche
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Bart Van Assche @ 2018-01-19 16:58 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Christoph Hellwig, Mike Snitzer, Ming Lei,
	Bart Van Assche

Most blk-mq functions have a name that follows the pattern blk_mq_${action}.
However, the function name blk_mq_request_direct_issue is an exception.
Hence rename this function. This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
---
 block/blk-core.c | 2 +-
 block/blk-mq.c   | 4 ++--
 block/blk-mq.h   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 4ae295c1be2d..5c21d6b97985 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2525,7 +2525,7 @@ blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request *
 		 * bypass a potential scheduler on the bottom device for
 		 * insert.
 		 */
-		return blk_mq_request_direct_issue(rq);
+		return blk_mq_request_issue_directly(rq);
 	}
 
 	spin_lock_irqsave(q->queue_lock, flags);
diff --git a/block/blk-mq.c b/block/blk-mq.c
index f7515dd95a36..6859b5492509 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1787,7 +1787,7 @@ static blk_status_t __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
 	 * RCU or SRCU read lock is needed before checking quiesced flag.
 	 *
 	 * When queue is stopped or quiesced, ignore 'bypass_insert' from
-	 * blk_mq_request_direct_issue(), and return BLK_STS_OK to caller,
+	 * blk_mq_request_issue_directly(), and return BLK_STS_OK to caller,
 	 * and avoid driver to try to dispatch again.
 	 */
 	if (blk_mq_hctx_stopped(hctx) || blk_queue_quiesced(q)) {
@@ -1835,7 +1835,7 @@ static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
 	hctx_unlock(hctx, srcu_idx);
 }
 
-blk_status_t blk_mq_request_direct_issue(struct request *rq)
+blk_status_t blk_mq_request_issue_directly(struct request *rq)
 {
 	blk_status_t ret;
 	int srcu_idx;
diff --git a/block/blk-mq.h b/block/blk-mq.h
index e3ebc93646ca..88c558f71819 100644
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -75,7 +75,7 @@ void blk_mq_insert_requests(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx,
 				struct list_head *list);
 
 /* Used by blk_insert_cloned_request() to issue request directly */
-blk_status_t blk_mq_request_direct_issue(struct request *rq);
+blk_status_t blk_mq_request_issue_directly(struct request *rq);
 
 /*
  * CPU -> queue mappings
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] blk-mq: Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays
  2018-01-19 16:58 [PATCH 0/3] Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays Bart Van Assche
  2018-01-19 16:58 ` [PATCH 1/3] blk-mq: Rename blk_mq_request_direct_issue() into blk_mq_request_issue_directly() Bart Van Assche
@ 2018-01-19 16:58 ` Bart Van Assche
  2018-01-19 17:21   ` Mike Snitzer
  2018-01-19 16:58 ` [PATCH 3/3] block: Remove kblockd_schedule_delayed_work{,_on}() Bart Van Assche
  2018-01-19 19:54 ` [PATCH 0/3] Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays Jens Axboe
  3 siblings, 1 reply; 8+ messages in thread
From: Bart Van Assche @ 2018-01-19 16:58 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Christoph Hellwig, Mike Snitzer, Ming Lei,
	Bart Van Assche

Make sure that calling blk_mq_run_hw_queue() or
blk_mq_kick_requeue_list() triggers a queue run without delay even
if blk_mq_delay_run_hw_queue() has been called recently and if its
delay has not yet expired.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
---
 block/blk-mq.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 6859b5492509..01f271d40825 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -787,7 +787,7 @@ EXPORT_SYMBOL(blk_mq_add_to_requeue_list);
 
 void blk_mq_kick_requeue_list(struct request_queue *q)
 {
-	kblockd_schedule_delayed_work(&q->requeue_work, 0);
+	kblockd_mod_delayed_work_on(WORK_CPU_UNBOUND, &q->requeue_work, 0);
 }
 EXPORT_SYMBOL(blk_mq_kick_requeue_list);
 
@@ -1403,9 +1403,8 @@ static void __blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async,
 		put_cpu();
 	}
 
-	kblockd_schedule_delayed_work_on(blk_mq_hctx_next_cpu(hctx),
-					 &hctx->run_work,
-					 msecs_to_jiffies(msecs));
+	kblockd_mod_delayed_work_on(blk_mq_hctx_next_cpu(hctx), &hctx->run_work,
+				    msecs_to_jiffies(msecs));
 }
 
 void blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs)
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] block: Remove kblockd_schedule_delayed_work{,_on}()
  2018-01-19 16:58 [PATCH 0/3] Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays Bart Van Assche
  2018-01-19 16:58 ` [PATCH 1/3] blk-mq: Rename blk_mq_request_direct_issue() into blk_mq_request_issue_directly() Bart Van Assche
  2018-01-19 16:58 ` [PATCH 2/3] blk-mq: Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays Bart Van Assche
@ 2018-01-19 16:58 ` Bart Van Assche
  2018-01-19 17:22   ` Mike Snitzer
  2018-01-19 19:54 ` [PATCH 0/3] Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays Jens Axboe
  3 siblings, 1 reply; 8+ messages in thread
From: Bart Van Assche @ 2018-01-19 16:58 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Christoph Hellwig, Mike Snitzer, Ming Lei,
	Bart Van Assche

The previous patch removed all users of these two functions. Hence
also remove the functions themselves.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
---
 block/blk-core.c       | 14 --------------
 include/linux/blkdev.h |  2 --
 2 files changed, 16 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 5c21d6b97985..a2005a485335 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -3446,20 +3446,6 @@ int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork,
 }
 EXPORT_SYMBOL(kblockd_mod_delayed_work_on);
 
-int kblockd_schedule_delayed_work(struct delayed_work *dwork,
-				  unsigned long delay)
-{
-	return queue_delayed_work(kblockd_workqueue, dwork, delay);
-}
-EXPORT_SYMBOL(kblockd_schedule_delayed_work);
-
-int kblockd_schedule_delayed_work_on(int cpu, struct delayed_work *dwork,
-				     unsigned long delay)
-{
-	return queue_delayed_work_on(cpu, kblockd_workqueue, dwork, delay);
-}
-EXPORT_SYMBOL(kblockd_schedule_delayed_work_on);
-
 /**
  * blk_start_plug - initialize blk_plug and track it inside the task_struct
  * @plug:	The &struct blk_plug that needs to be initialized
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index a4c7aafb686d..4f3df807cf8f 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1817,8 +1817,6 @@ static inline bool req_gap_front_merge(struct request *req, struct bio *bio)
 
 int kblockd_schedule_work(struct work_struct *work);
 int kblockd_schedule_work_on(int cpu, struct work_struct *work);
-int kblockd_schedule_delayed_work(struct delayed_work *dwork, unsigned long delay);
-int kblockd_schedule_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay);
 int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay);
 
 #ifdef CONFIG_BLK_CGROUP
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] blk-mq: Rename blk_mq_request_direct_issue() into blk_mq_request_issue_directly()
  2018-01-19 16:58 ` [PATCH 1/3] blk-mq: Rename blk_mq_request_direct_issue() into blk_mq_request_issue_directly() Bart Van Assche
@ 2018-01-19 17:20   ` Mike Snitzer
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Snitzer @ 2018-01-19 17:20 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Jens Axboe, linux-block, Christoph Hellwig, Ming Lei

On Fri, Jan 19 2018 at 11:58am -0500,
Bart Van Assche <bart.vanassche@wdc.com> wrote:

> Most blk-mq functions have a name that follows the pattern blk_mq_${action}.
> However, the function name blk_mq_request_direct_issue is an exception.
> Hence rename this function. This patch does not change any functionality.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>

Reviewed-by: Mike Snitzer <snitzer@redhat.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] blk-mq: Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays
  2018-01-19 16:58 ` [PATCH 2/3] blk-mq: Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays Bart Van Assche
@ 2018-01-19 17:21   ` Mike Snitzer
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Snitzer @ 2018-01-19 17:21 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Jens Axboe, linux-block, Christoph Hellwig, Ming Lei

On Fri, Jan 19 2018 at 11:58am -0500,
Bart Van Assche <bart.vanassche@wdc.com> wrote:

> Make sure that calling blk_mq_run_hw_queue() or
> blk_mq_kick_requeue_list() triggers a queue run without delay even
> if blk_mq_delay_run_hw_queue() has been called recently and if its
> delay has not yet expired.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>

Reviewed-by: Mike Snitzer <snitzer@redhat.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] block: Remove kblockd_schedule_delayed_work{,_on}()
  2018-01-19 16:58 ` [PATCH 3/3] block: Remove kblockd_schedule_delayed_work{,_on}() Bart Van Assche
@ 2018-01-19 17:22   ` Mike Snitzer
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Snitzer @ 2018-01-19 17:22 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Jens Axboe, linux-block, Christoph Hellwig, Ming Lei

On Fri, Jan 19 2018 at 11:58am -0500,
Bart Van Assche <bart.vanassche@wdc.com> wrote:

> The previous patch removed all users of these two functions. Hence
> also remove the functions themselves.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>

Reviewed-by: Mike Snitzer <snitzer@redhat.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays
  2018-01-19 16:58 [PATCH 0/3] Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays Bart Van Assche
                   ` (2 preceding siblings ...)
  2018-01-19 16:58 ` [PATCH 3/3] block: Remove kblockd_schedule_delayed_work{,_on}() Bart Van Assche
@ 2018-01-19 19:54 ` Jens Axboe
  3 siblings, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2018-01-19 19:54 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: linux-block, Christoph Hellwig, Mike Snitzer, Ming Lei

On 1/19/18 9:58 AM, Bart Van Assche wrote:
> Hello Jens,
> 
> Earlier today it was agreed that a blk_mq_delay_run_hw_queue() call followed
> by a blk_mq_run_hw_queue() call should result in an immediate queue run. Hence
> this patch series. Please consider this patch series for kernel v4.16.

Thanks Bart, applied.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-01-19 19:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-19 16:58 [PATCH 0/3] Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays Bart Van Assche
2018-01-19 16:58 ` [PATCH 1/3] blk-mq: Rename blk_mq_request_direct_issue() into blk_mq_request_issue_directly() Bart Van Assche
2018-01-19 17:20   ` Mike Snitzer
2018-01-19 16:58 ` [PATCH 2/3] blk-mq: Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays Bart Van Assche
2018-01-19 17:21   ` Mike Snitzer
2018-01-19 16:58 ` [PATCH 3/3] block: Remove kblockd_schedule_delayed_work{,_on}() Bart Van Assche
2018-01-19 17:22   ` Mike Snitzer
2018-01-19 19:54 ` [PATCH 0/3] Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays Jens Axboe

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).