aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2009-10-03 09:21:27 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-10-03 09:21:27 -0400
commit365722bb917b08b7323b5a4a0a3386cc7d00397d (patch)
treee882cb339a7055169596ca4b267087bbf1672709
parent1d2235152dc745c6d94bedb550fea84cffdbf768 (diff)
cfq-iosched: delay async IO dispatch, if sync IO was just done
o Do not allow more than max_dispatch requests from an async queue, if some sync request has finished recently. This is in the hope that sync activity is still going on in the system and we might receive a sync request soon. Most likely from a sync queue which finished a request and we did not enable idling on it. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--block/cfq-iosched.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 8917f2b3a783..70b48ea0e3e9 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -181,6 +181,8 @@ struct cfq_data {
181 * Fallback dummy cfqq for extreme OOM conditions 181 * Fallback dummy cfqq for extreme OOM conditions
182 */ 182 */
183 struct cfq_queue oom_cfqq; 183 struct cfq_queue oom_cfqq;
184
185 unsigned long last_end_sync_rq;
184}; 186};
185 187
186enum cfqq_state_flags { 188enum cfqq_state_flags {
@@ -1314,6 +1316,8 @@ static int cfq_dispatch_requests(struct request_queue *q, int force)
1314 * Does this cfqq already have too much IO in flight? 1316 * Does this cfqq already have too much IO in flight?
1315 */ 1317 */
1316 if (cfqq->dispatched >= max_dispatch) { 1318 if (cfqq->dispatched >= max_dispatch) {
1319 unsigned long load_at = cfqd->last_end_sync_rq + cfq_slice_sync;
1320
1317 /* 1321 /*
1318 * idle queue must always only have a single IO in flight 1322 * idle queue must always only have a single IO in flight
1319 */ 1323 */
@@ -1327,6 +1331,14 @@ static int cfq_dispatch_requests(struct request_queue *q, int force)
1327 return 0; 1331 return 0;
1328 1332
1329 /* 1333 /*
1334 * If a sync request has completed recently, don't overload
1335 * the dispatch queue yet with async requests.
1336 */
1337 if (cfqd->cfq_desktop && !cfq_cfqq_sync(cfqq)
1338 && time_before(jiffies, load_at))
1339 return 0;
1340
1341 /*
1330 * we are the only queue, allow up to 4 times of 'quantum' 1342 * we are the only queue, allow up to 4 times of 'quantum'
1331 */ 1343 */
1332 if (cfqq->dispatched >= 4 * max_dispatch) 1344 if (cfqq->dispatched >= 4 * max_dispatch)
@@ -2158,8 +2170,10 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq)
2158 if (cfq_cfqq_sync(cfqq)) 2170 if (cfq_cfqq_sync(cfqq))
2159 cfqd->sync_flight--; 2171 cfqd->sync_flight--;
2160 2172
2161 if (sync) 2173 if (sync) {
2162 RQ_CIC(rq)->last_end_request = now; 2174 RQ_CIC(rq)->last_end_request = now;
2175 cfqd->last_end_sync_rq = now;
2176 }
2163 2177
2164 /* 2178 /*
2165 * If this is the active queue, check if it needs to be expired, 2179 * If this is the active queue, check if it needs to be expired,
@@ -2483,7 +2497,7 @@ static void *cfq_init_queue(struct request_queue *q)
2483 cfqd->cfq_slice_idle = cfq_slice_idle; 2497 cfqd->cfq_slice_idle = cfq_slice_idle;
2484 cfqd->cfq_desktop = 1; 2498 cfqd->cfq_desktop = 1;
2485 cfqd->hw_tag = 1; 2499 cfqd->hw_tag = 1;
2486 2500 cfqd->last_end_sync_rq = jiffies;
2487 return cfqd; 2501 return cfqd;
2488} 2502}
2489 2503