mirror of https://github.com/torvalds/linux.git
blk-mq: add QUEUE_FLAG_BIO_ISSUE_TIME
bio->issue_time_ns is initialized for every bio, however, it's only used by blk-iolatency. Add a new queue_flag and only set this flag when blk-iolatency is enabled, so that extra blk_time_get_ns() can be saved for disks that blk-iolatency is not enabled. Signed-off-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
1f963bdd64
commit
ea3d1f104d
|
|
@ -742,10 +742,15 @@ static void blkiolatency_enable_work_fn(struct work_struct *work)
|
||||||
*/
|
*/
|
||||||
enabled = atomic_read(&blkiolat->enable_cnt);
|
enabled = atomic_read(&blkiolat->enable_cnt);
|
||||||
if (enabled != blkiolat->enabled) {
|
if (enabled != blkiolat->enabled) {
|
||||||
|
struct request_queue *q = blkiolat->rqos.disk->queue;
|
||||||
unsigned int memflags;
|
unsigned int memflags;
|
||||||
|
|
||||||
memflags = blk_mq_freeze_queue(blkiolat->rqos.disk->queue);
|
memflags = blk_mq_freeze_queue(blkiolat->rqos.disk->queue);
|
||||||
blkiolat->enabled = enabled;
|
blkiolat->enabled = enabled;
|
||||||
|
if (enabled)
|
||||||
|
blk_queue_flag_set(QUEUE_FLAG_BIO_ISSUE_TIME, q);
|
||||||
|
else
|
||||||
|
blk_queue_flag_clear(QUEUE_FLAG_BIO_ISSUE_TIME, q);
|
||||||
blk_mq_unfreeze_queue(blkiolat->rqos.disk->queue, memflags);
|
blk_mq_unfreeze_queue(blkiolat->rqos.disk->queue, memflags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ static const char *const blk_queue_flag_name[] = {
|
||||||
QUEUE_FLAG_NAME(DISABLE_WBT_DEF),
|
QUEUE_FLAG_NAME(DISABLE_WBT_DEF),
|
||||||
QUEUE_FLAG_NAME(NO_ELV_SWITCH),
|
QUEUE_FLAG_NAME(NO_ELV_SWITCH),
|
||||||
QUEUE_FLAG_NAME(QOS_ENABLED),
|
QUEUE_FLAG_NAME(QOS_ENABLED),
|
||||||
|
QUEUE_FLAG_NAME(BIO_ISSUE_TIME),
|
||||||
};
|
};
|
||||||
#undef QUEUE_FLAG_NAME
|
#undef QUEUE_FLAG_NAME
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -396,9 +396,11 @@ static inline void blk_mq_rq_time_init(struct request *rq, u64 alloc_time_ns)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void blk_mq_bio_issue_init(struct bio *bio)
|
static inline void blk_mq_bio_issue_init(struct request_queue *q,
|
||||||
|
struct bio *bio)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_BLK_CGROUP
|
#ifdef CONFIG_BLK_CGROUP
|
||||||
|
if (test_bit(QUEUE_FLAG_BIO_ISSUE_TIME, &q->queue_flags))
|
||||||
bio->issue_time_ns = blk_time_get_ns();
|
bio->issue_time_ns = blk_time_get_ns();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -3175,7 +3177,7 @@ void blk_mq_submit_bio(struct bio *bio)
|
||||||
if (!bio_integrity_prep(bio))
|
if (!bio_integrity_prep(bio))
|
||||||
goto queue_exit;
|
goto queue_exit;
|
||||||
|
|
||||||
blk_mq_bio_issue_init(bio);
|
blk_mq_bio_issue_init(q, bio);
|
||||||
if (blk_mq_attempt_bio_merge(q, bio, nr_segs))
|
if (blk_mq_attempt_bio_merge(q, bio, nr_segs))
|
||||||
goto queue_exit;
|
goto queue_exit;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -657,6 +657,7 @@ enum {
|
||||||
QUEUE_FLAG_DISABLE_WBT_DEF, /* for sched to disable/enable wbt */
|
QUEUE_FLAG_DISABLE_WBT_DEF, /* for sched to disable/enable wbt */
|
||||||
QUEUE_FLAG_NO_ELV_SWITCH, /* can't switch elevator any more */
|
QUEUE_FLAG_NO_ELV_SWITCH, /* can't switch elevator any more */
|
||||||
QUEUE_FLAG_QOS_ENABLED, /* qos is enabled */
|
QUEUE_FLAG_QOS_ENABLED, /* qos is enabled */
|
||||||
|
QUEUE_FLAG_BIO_ISSUE_TIME, /* record bio->issue_time_ns */
|
||||||
QUEUE_FLAG_MAX
|
QUEUE_FLAG_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue