[patch v2 6/8]block: fiops bias sync workload

From: Shaohua Li
Date: Mon Jan 30 2012 - 02:09:05 EST


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.

Signed-off-by: Shaohua Li <shaohua.li@xxxxxxxxx>
---
block/fiops-iosched.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

Index: linux/block/fiops-iosched.c
===================================================================
--- linux.orig/block/fiops-iosched.c 2012-01-19 11:21:01.000000000 +0800
+++ linux/block/fiops-iosched.c 2012-01-21 10:30:46.000000000 +0800
@@ -372,6 +372,7 @@ static struct fiops_ioc *fiops_select_io
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_io
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;
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/