blk-iocost: skip empty flush bio in iocost
Subsystems (3)
PATCH 1/1 blk-iocost: skip empty flush bio in iocost
From: Chengming Zhou <[email protected]>
The flush bio may have data, may have no data (empty flush), we couldn't calculate cost for empty flush bio. So we'd better just skip it for now.
Another side effect is that empty flush bio's bio_end_sector() is 0, cause iocg->cursor reset to 0, may break the cost calculation of other bios.
This isn't good enough, since flush bio still consume the device bandwidth, but flush request is special, can be merged randomly in the flush state machine, we don't know how to calculate cost for it for now.
Its completion time also has flaws, which may include the pre-flush or post-flush completion time, but I don't know if we need to fix that and how to fix it.
--- block/blk-iocost.c | 4 ++++ 1 file changed, 4 insertions(+)
block/blk-iocost.c +4 -0
@@ -2516,6 +2516,10 @@ static void calc_vtime_cost_builtin(struct bio *bio, struct ioc_gq *iocg,u64 seek_pages =0 ;u64 cost =0 ; +/* Can't calculate cost for empty bio */ +if (!bio->bi_iter.bi_size) + goto out; +switch (bio_op (bio)) {case REQ_OP_READ : coef_seqio = ioc->params.lcoefs[LCOEF_RSEQIO ];
Signature · 1 line
2.41.0
Quoted 12 lines · On Thu, Jul 20, 2023 at 08:14:41PM +0800, [email protected] wrote:
From: Chengming Zhou <[email protected]>
The flush bio may have data, may have no data (empty flush), we couldn't calculate cost for empty flush bio. So we'd better just skip it for now.
Another side effect is that empty flush bio's
bio_end_sector()is 0, causeiocg->cursorreset to 0, may break the cost calculation of other bios.This isn't good enough, since flush bio still consume the device bandwidth, but flush request is special, can be merged randomly in the flush state machine, we don't know how to calculate cost for it for now.
Quoted 5 lines
Its completion time also has flaws, which may include the pre-flush or post-flush completion time, but I don't know if we need to fix that and how to fix it.
Signed-off-by Chengming Zhou <[email protected]>
It's unlikely that this will change behaviors in an observable way in most cases. That said, yeah, ignoring it in terms of cost calculation is likely the better thing to do.
Thanks.
Signature · 1 line
tejun
Quoted 11 lines · On Thu, 20 Jul 2023 20:14:41 +0800, chengming.zhou-fxUVXftIFDnyG1zEObXtfA@publi…
The flush bio may have data, may have no data (empty flush), we couldn't calculate cost for empty flush bio. So we'd better just skip it for now.
Another side effect is that empty flush bio's
bio_end_sector()is 0, causeiocg->cursorreset to 0, may break the cost calculation of other bios.This isn't good enough, since flush bio still consume the device bandwidth, but flush request is special, can be merged randomly in the flush state machine, we don't know how to calculate cost for it for now.
[...]
Applied, thanks!
[1/1] blk-iocost: skip empty flush bio in iocost
commit: 013adcbef165c3eaf73e297b7482290593815ab8
Best regards,
Signature · 1 line
Jens Axboe