block: relax when to modify the timeout timer
authorJens Axboe <axboe@fb.com>
Wed, 16 Apr 2014 17:36:54 +0000 (11:36 -0600)
committerJens Axboe <axboe@fb.com>
Mon, 30 Mar 2015 18:54:43 +0000 (12:54 -0600)
commit2e968716c4df7a99a605aca2e7aab679eb252b57
treee9818bacc65c5865df5d1e1d55785bf7348a2bfa
parentf327de4020b7f038e09a5adbd2ed7c1d7e9d3ab6
block: relax when to modify the timeout timer

Since we are now, by default, applying timer slack to expiry times,
the logic for when to modify a timer in the block code is suboptimal.
The block layer keeps a forward rolling timer per queue for all
requests, and modifies this timer if a request has a shorter timeout
than what the current expiry time is. However, this breaks down
when our rounded timer values get applied slack. Then each new
request ends up modifying the timer, since we're still a little
in front of the timer + slack.

Fix this by allowing a tolerance of HZ / 2, the timeout handling
doesn't need to be very precise. This drastically cuts down
the number of timer modifications we have to make.

Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-timeout.c