diff options
| author | Jan Kara <jack@suse.cz> | 2016-06-28 09:04:01 +0200 |
|---|---|---|
| committer | Davide Garberi <dade.garberi@gmail.com> | 2022-07-27 18:58:39 +0200 |
| commit | cc45a36fc552cb80285c41fa5f6e21241c2b26b8 (patch) | |
| tree | e358cc063a77d63f2d6fbb9cb4c54cd40f8fa37f /block | |
| parent | 1a3627900ba4972463245b4ea1372e3354d5c691 (diff) | |
cfq-iosched: Fix regression in bonnie++ rewrite performance
Commit 9a7f38c42c2 (cfq-iosched: Convert from jiffies to nanoseconds)
broke the condition for detecting starved sync IO in
cfq_completed_request() because rq->start_time remained in jiffies but
we compared it with nanosecond values. This manifested as a regression
in bonnie++ rewrite performance because we always ended up considering
sync IO starved and thus never increased async IO queue depth.
Since rq->start_time is used in a lot of places, converting it to ns
values would be non-trivial. So just revert the condition in CFQ to use
comparison with jiffies. This will lead to suboptimal results if
cfq_fifo_expire[1] will ever come close to 1 jiffie but so far we are
relatively far from that with the storage used with CFQ (the default
value is 128 ms).
Fixes: 9a7f38c42c2b92391d9dabaf9f51df7cfe5608e4
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
| -rw-r--r-- | block/cfq-iosched.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index df4e74300f38..aa71ac42aa6b 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -4246,7 +4246,16 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq) cfqq_type(cfqq)); st->ttime.last_end_request = now; - if (!(rq->start_time + cfqd->cfq_fifo_expire[1] > now)) + /* + * We have to do this check in jiffies since start_time is in + * jiffies and it is not trivial to convert to ns. If + * cfq_fifo_expire[1] ever comes close to 1 jiffie, this test + * will become problematic but so far we are fine (the default + * is 128 ms). + */ + if (!time_after(rq->start_time + + nsecs_to_jiffies(cfqd->cfq_fifo_expire[1]), + jiffies)) cfqd->last_delayed_sync = now; } |
