[Bionic,v2,09/21] blk-mq: Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays

Message ID 20180510162334.2058-10-joserz@linux.vnet.ibm.com
State New
Headers show
Series
  • blk-mq scheduler fixes
Related show

Commit Message

Jose Ricardo Ziviani May 10, 2018, 4:23 p.m.
From: Bart Van Assche <bart.vanassche@wdc.com>

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.

Reviewed-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit ae943d20624de0a6aac7dd0597616dce2c498029)
Signed-off-by: Jose Ricardo Ziviani <joserz@linux.ibm.com>
---
 block/blk-mq.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Patch

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 59f4127bdaed..f5e7624d6fe1 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -731,7 +731,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);
 
@@ -1321,9 +1321,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)