aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2011-01-14 02:41:02 -0500
committerJens Axboe <jaxboe@fusionio.com>2011-01-14 02:41:02 -0500
commitf8ae6e3eb8251be32c6e913393d9f8d9e0609489 (patch)
tree50b096572a4f8e7992e7e7e2e599e77d334c2b5b /block
parent52cfd503ad7176d23a5dd7af3981744feb60622f (diff)
block cfq: make queue preempt work for queues from different workload
I got this: fio-874 [007] 2157.724514: 8,32 m N cfq874 preempt fio-874 [007] 2157.724519: 8,32 m N cfq830 slice expired t=1 fio-874 [007] 2157.724520: 8,32 m N cfq830 sl_used=1 disp=0 charge=1 iops=0 sect=0 fio-874 [007] 2157.724521: 8,32 m N cfq830 set_active wl_prio:0 wl_type:0 fio-874 [007] 2157.724522: 8,32 m N cfq830 Not idling. st->count:1 cfq830 is an async queue, and preempted by a sync queue cfq874. But since we have cfqg->saved_workload_slice mechanism, the preempt is a nop. Looks currently our preempt is totally broken if the two queues are not from the same workload type. Below patch fixes it. This will might make async queue starvation, but it's what our old code does before cgroup is added. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block')
-rw-r--r--block/cfq-iosched.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 8427697c5437..7bfea53c1bb5 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -3284,10 +3284,19 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
3284 */ 3284 */
3285static void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq) 3285static void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq)
3286{ 3286{
3287 struct cfq_queue *old_cfqq = cfqd->active_queue;
3288
3287 cfq_log_cfqq(cfqd, cfqq, "preempt"); 3289 cfq_log_cfqq(cfqd, cfqq, "preempt");
3288 cfq_slice_expired(cfqd, 1); 3290 cfq_slice_expired(cfqd, 1);
3289 3291
3290 /* 3292 /*
3293 * workload type is changed, don't save slice, otherwise preempt
3294 * doesn't happen
3295 */
3296 if (cfqq_type(old_cfqq) != cfqq_type(cfqq))
3297 cfqq->cfqg->saved_workload_slice = 0;
3298
3299 /*
3291 * Put the new queue at the front of the of the current list, 3300 * Put the new queue at the front of the of the current list,
3292 * so we know that it will be selected next. 3301 * so we know that it will be selected next.
3293 */ 3302 */