Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Yu Kuai and committed by
Jens Axboe
ea3d1f10 1f963bdd

+12 -3
+5
block/blk-iolatency.c
··· 742 742 */ 743 743 enabled = atomic_read(&blkiolat->enable_cnt); 744 744 if (enabled != blkiolat->enabled) { 745 + struct request_queue *q = blkiolat->rqos.disk->queue; 745 746 unsigned int memflags; 746 747 747 748 memflags = blk_mq_freeze_queue(blkiolat->rqos.disk->queue); 748 749 blkiolat->enabled = enabled; 750 + if (enabled) 751 + blk_queue_flag_set(QUEUE_FLAG_BIO_ISSUE_TIME, q); 752 + else 753 + blk_queue_flag_clear(QUEUE_FLAG_BIO_ISSUE_TIME, q); 749 754 blk_mq_unfreeze_queue(blkiolat->rqos.disk->queue, memflags); 750 755 } 751 756 }
+1
block/blk-mq-debugfs.c
··· 96 96 QUEUE_FLAG_NAME(DISABLE_WBT_DEF), 97 97 QUEUE_FLAG_NAME(NO_ELV_SWITCH), 98 98 QUEUE_FLAG_NAME(QOS_ENABLED), 99 + QUEUE_FLAG_NAME(BIO_ISSUE_TIME), 99 100 }; 100 101 #undef QUEUE_FLAG_NAME 101 102
+5 -3
block/blk-mq.c
··· 396 396 #endif 397 397 } 398 398 399 - static inline void blk_mq_bio_issue_init(struct bio *bio) 399 + static inline void blk_mq_bio_issue_init(struct request_queue *q, 400 + struct bio *bio) 400 401 { 401 402 #ifdef CONFIG_BLK_CGROUP 402 - bio->issue_time_ns = blk_time_get_ns(); 403 + if (test_bit(QUEUE_FLAG_BIO_ISSUE_TIME, &q->queue_flags)) 404 + bio->issue_time_ns = blk_time_get_ns(); 403 405 #endif 404 406 } 405 407 ··· 3177 3175 if (!bio_integrity_prep(bio)) 3178 3176 goto queue_exit; 3179 3177 3180 - blk_mq_bio_issue_init(bio); 3178 + blk_mq_bio_issue_init(q, bio); 3181 3179 if (blk_mq_attempt_bio_merge(q, bio, nr_segs)) 3182 3180 goto queue_exit; 3183 3181
+1
include/linux/blkdev.h
··· 657 657 QUEUE_FLAG_DISABLE_WBT_DEF, /* for sched to disable/enable wbt */ 658 658 QUEUE_FLAG_NO_ELV_SWITCH, /* can't switch elevator any more */ 659 659 QUEUE_FLAG_QOS_ENABLED, /* qos is enabled */ 660 + QUEUE_FLAG_BIO_ISSUE_TIME, /* record bio->issue_time_ns */ 660 661 QUEUE_FLAG_MAX 661 662 }; 662 663