[PATCH 2/8] block: Do not run frozen queues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If a request queue is frozen there are no requests pending and hence it
is not necessary to run a request queue.

Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
 block/blk-mq.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 7919607c1aeb..91b9fc1a7ddb 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2298,16 +2298,16 @@ static inline bool blk_mq_hw_queue_need_run(struct blk_mq_hw_ctx *hctx)
 	bool need_run;
 
 	/*
-	 * When queue is quiesced, we may be switching io scheduler, or
-	 * updating nr_hw_queues, or other things, and we can't run queue
-	 * any more, even blk_mq_hctx_has_pending() can't be called safely.
-	 *
-	 * And queue will be rerun in blk_mq_unquiesce_queue() if it is
-	 * quiesced.
+	 * The request queue is frozen when the e.g. the I/O scheduler is
+	 * changed and also when nr_hw_queues is updated. Neither running the
+	 * queue nor calling blk_mq_hctx_has_pending() is safe during these
+	 * operations. Hence, check whether the queue is frozen before checking
+	 * whether any requests are pending.
 	 */
 	__blk_mq_run_dispatch_ops(hctx->queue, false,
-		need_run = !blk_queue_quiesced(hctx->queue) &&
-		blk_mq_hctx_has_pending(hctx));
+		need_run = !blk_queue_frozen(hctx->queue) &&
+			   !blk_queue_quiesced(hctx->queue) &&
+			   blk_mq_hctx_has_pending(hctx));
 	return need_run;
 }
 




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux