aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2012-12-15 22:37:22 -0800
committerMoyster <oysterized@gmail.com>2016-09-13 13:13:51 +0200
commit3f2850057dcc9bf82b4354422aa428f1c5392609 (patch)
treee4a6896fd3eacce2c5d0e19c2d42832b0c137d20 /block
parent6626327e2987cd4081b93f91a16eae51888f50f0 (diff)
block: fiops bias sync workload
If there are async requests running, delay async workload. Otherwise async workload (usually very deep iodepth) will use all queue iodepth and later sync requests will get long delayed. The idea is from CFQ. Change-Id: I66b8b87ca33c9e92ed52067cead54a4fc48c6426 Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Diffstat (limited to 'block')
-rw-r--r--block/fiops-iosched.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/block/fiops-iosched.c b/block/fiops-iosched.c
index 84189f385..be54a9c70 100644
--- a/block/fiops-iosched.c
+++ b/block/fiops-iosched.c
@@ -372,6 +372,7 @@ static struct fiops_ioc *fiops_select_ioc(struct fiops_data *fiopsd)
struct fiops_ioc *ioc;
struct fiops_rb_root *service_tree = NULL;
int i;
+ struct request *rq;
for (i = RT_WORKLOAD; i >= IDLE_WORKLOAD; i--) {
if (!RB_EMPTY_ROOT(&fiopsd->service_tree[i].rb)) {
@@ -384,6 +385,17 @@ static struct fiops_ioc *fiops_select_ioc(struct fiops_data *fiopsd)
return NULL;
ioc = fiops_rb_first(service_tree);
+
+ rq = rq_entry_fifo(ioc->fifo.next);
+ /*
+ * we are the only async task and sync requests are in flight, delay a
+ * moment. If there are other tasks coming, sync tasks have no chance
+ * to be starved, don't delay
+ */
+ if (!rq_is_sync(rq) && fiopsd->in_flight[1] != 0 &&
+ service_tree->count == 1)
+ return NULL;
+
return ioc;
}