blk-mq: Enable support for runtime power management
authorBart Van Assche <bvanassche@acm.org>
Wed, 26 Sep 2018 21:01:10 +0000 (14:01 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 26 Sep 2018 21:11:29 +0000 (15:11 -0600)
Now that the blk-mq core processes power management requests
(marked with RQF_PREEMPT) in other states than RPM_ACTIVE, enable
runtime power management for blk-mq.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Jianchao Wang <jianchao.w.wang@oracle.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c
block/blk-pm.c

index 96d501e8663cad68fe267ebdea02ec3e79bf0421..d384ab700afde2eca3f016f71e31963f9884ca9e 100644 (file)
@@ -33,6 +33,7 @@
 #include "blk-mq.h"
 #include "blk-mq-debugfs.h"
 #include "blk-mq-tag.h"
+#include "blk-pm.h"
 #include "blk-stat.h"
 #include "blk-mq-sched.h"
 #include "blk-rq-qos.h"
@@ -475,6 +476,7 @@ static void __blk_mq_free_request(struct request *rq)
        struct blk_mq_hw_ctx *hctx = blk_mq_map_queue(q, ctx->cpu);
        const int sched_tag = rq->internal_tag;
 
+       blk_pm_mark_last_busy(rq);
        if (rq->tag != -1)
                blk_mq_put_tag(hctx, hctx->tags, ctx, rq->tag);
        if (sched_tag != -1)
index 972fbc65684662764701e3944182b5bea19bc28c..f8fdae01bea2a01ab91339bbde06d308cc88be8a 100644 (file)
  */
 void blk_pm_runtime_init(struct request_queue *q, struct device *dev)
 {
-       /* Don't enable runtime PM for blk-mq until it is ready */
-       if (q->mq_ops) {
-               pm_runtime_disable(dev);
-               return;
-       }
-
        q->dev = dev;
        q->rpm_status = RPM_ACTIVE;
        pm_runtime_set_autosuspend_delay(q->dev, -1);