diff options
author | Shaohua Li <shaohua.li@intel.com> | 2009-10-27 03:46:23 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-10-27 03:46:23 -0400 |
commit | 1a1238a7dd48e48b3bba8f426a1d61c22c80d6d1 (patch) | |
tree | 08a39610689b5da8e8d61701864b8eb257acd6d7 /block | |
parent | e6c5bc737ab71e4af6025ef7d150f5a26ae5f146 (diff) |
cfq-iosched: improve hw_tag detection
If active queue hasn't enough requests and idle window opens, cfq will not
dispatch sufficient requests to hardware. In such situation, current code
will zero hw_tag. But this is because cfq doesn't dispatch enough requests
instead of hardware queue doesn't work. Don't zero hw_tag in such case.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/cfq-iosched.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 47d6aaca0c51..418da9a49bb0 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -2257,6 +2257,8 @@ static void cfq_insert_request(struct request_queue *q, struct request *rq) | |||
2257 | */ | 2257 | */ |
2258 | static void cfq_update_hw_tag(struct cfq_data *cfqd) | 2258 | static void cfq_update_hw_tag(struct cfq_data *cfqd) |
2259 | { | 2259 | { |
2260 | struct cfq_queue *cfqq = cfqd->active_queue; | ||
2261 | |||
2260 | if (rq_in_driver(cfqd) > cfqd->rq_in_driver_peak) | 2262 | if (rq_in_driver(cfqd) > cfqd->rq_in_driver_peak) |
2261 | cfqd->rq_in_driver_peak = rq_in_driver(cfqd); | 2263 | cfqd->rq_in_driver_peak = rq_in_driver(cfqd); |
2262 | 2264 | ||
@@ -2264,6 +2266,16 @@ static void cfq_update_hw_tag(struct cfq_data *cfqd) | |||
2264 | rq_in_driver(cfqd) <= CFQ_HW_QUEUE_MIN) | 2266 | rq_in_driver(cfqd) <= CFQ_HW_QUEUE_MIN) |
2265 | return; | 2267 | return; |
2266 | 2268 | ||
2269 | /* | ||
2270 | * If active queue hasn't enough requests and can idle, cfq might not | ||
2271 | * dispatch sufficient requests to hardware. Don't zero hw_tag in this | ||
2272 | * case | ||
2273 | */ | ||
2274 | if (cfqq && cfq_cfqq_idle_window(cfqq) && | ||
2275 | cfqq->dispatched + cfqq->queued[0] + cfqq->queued[1] < | ||
2276 | CFQ_HW_QUEUE_MIN && rq_in_driver(cfqd) < CFQ_HW_QUEUE_MIN) | ||
2277 | return; | ||
2278 | |||
2267 | if (cfqd->hw_tag_samples++ < 50) | 2279 | if (cfqd->hw_tag_samples++ < 50) |
2268 | return; | 2280 | return; |
2269 | 2281 | ||