[Devel] [PATCH][cfq-cgroups][Option 1] Introduce a think time valid entry.

Satoshi UCHIDA s-uchida at ap.jp.nec.com
Wed Nov 12 00:37:24 PST 2008


  This patch introduces a think time valid entry.
 
  A think time is effective when queue is poor I/O requests
  because its queue is handled as idle class and then
  next queue can start to dispatch requests right after it.
  However, if there are many tasks, a value of think time is bigger.
  So, many queue are handled as idle class.
  Many queue will dispatch few requests(one request) and then
  expire slice.
  Namely, ioprio control for their queues is invalid.

  A think time valid entry is decide to check think time.
  The value 0 is always handled as idle class.
  The value 1 is handled as same as traditional CFQ.
  The value 2 make think time invalid.


    Signed-off-by: Satoshi UCHIDA <s-uchida at ap.jp.nec.com>

---
 block/cfq-cgroup.c          |    2 ++
 block/cfq-iosched.c         |    9 ++++++++-
 include/linux/cfq-iosched.h |    1 +
 3 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/block/cfq-cgroup.c b/block/cfq-cgroup.c
index 776874d..b407768 100644
--- a/block/cfq-cgroup.c
+++ b/block/cfq-cgroup.c
@@ -922,6 +922,7 @@ SHOW_FUNCTION(cfq_cgroup_slice_sync_show, cfq_slice[1], 1);
 SHOW_FUNCTION(cfq_cgroup_slice_async_show, cfq_slice[0], 1);
 SHOW_FUNCTION(cfq_cgroup_slice_async_rq_show, cfq_slice_async_rq, 0);
 SHOW_FUNCTION(cfq_cgroup_ioprio_show, ioprio, 0);
+SHOW_FUNCTION(cfq_cgroup_ttime_valid_show, cfq_ttime_valid, 0);
 #undef SHOW_FUNCTION
 
 static ssize_t
@@ -1026,6 +1027,7 @@ STORE_FUNCTION(cfq_cgroup_slice_async_store, cfq_slice[0], 1, UINT_MAX, 1);
 STORE_FUNCTION(cfq_cgroup_slice_async_rq_store, cfq_slice_async_rq, 1,
 		UINT_MAX, 0);
 STORE_FUNCTION(cfq_cgroup_ioprio_store, ioprio, 0, CFQ_CGROUP_MAX_IOPRIO, 0);
+STORE_FUNCTION(cfq_cgroup_ttime_valid_store, cfq_ttime_valid, 0, 2, 0);
 #undef STORE_FUNCTION
 
 static ssize_t
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index edc23e5..51dccad 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -28,6 +28,8 @@ static const int cfq_slice_sync = HZ / 10;
 static int cfq_slice_async = HZ / 25;
 static const int cfq_slice_async_rq = 2;
 static int cfq_slice_idle = HZ / 125;
+/* think time valid flag */
+static int cfq_ttime_valid = 1;
 
 /*
  * offset from end of service tree
@@ -1731,7 +1733,8 @@ cfq_update_idle_window(struct cfq_data *cfqd, struct cfq_queue *cfqq,
 	    (cfqd->cfqdd->hw_tag && CIC_SEEKY(cic)))
 		enable_idle = 0;
 	else if (sample_valid(cic->ttime_samples)) {
-		if (cic->ttime_mean > cfqd->cfq_slice_idle)
+		if (cic->ttime_mean >
+			cfqd->cfq_slice_idle * cfqd->cfq_ttime_valid)
 			enable_idle = 0;
 		else
 			enable_idle = 1;
@@ -2304,6 +2307,7 @@ struct cfq_data *cfq_init_cfq_data(struct request_queue *q,
 	cfqd->cfq_slice[1] = cfq_slice_sync;
 	cfqd->cfq_slice_async_rq = cfq_slice_async_rq;
 	cfqd->cfq_slice_idle = cfq_slice_idle;
+	cfqd->cfq_ttime_valid = cfq_ttime_valid;
 
 	return cfqd;
 }
@@ -2381,6 +2385,7 @@ SHOW_FUNCTION(cfq_slice_idle_show, cfqd->cfq_slice_idle, 1);
 SHOW_FUNCTION(cfq_slice_sync_show, cfqd->cfq_slice[1], 1);
 SHOW_FUNCTION(cfq_slice_async_show, cfqd->cfq_slice[0], 1);
 SHOW_FUNCTION(cfq_slice_async_rq_show, cfqd->cfq_slice_async_rq, 0);
+SHOW_FUNCTION(cfq_ttime_valid_show, cfqd->cfq_ttime_valid, 0);
 #undef SHOW_FUNCTION
 
 #define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX, __CONV)			\
@@ -2412,6 +2417,7 @@ STORE_FUNCTION(cfq_slice_sync_store, &cfqd->cfq_slice[1], 1, UINT_MAX, 1);
 STORE_FUNCTION(cfq_slice_async_store, &cfqd->cfq_slice[0], 1, UINT_MAX, 1);
 STORE_FUNCTION(cfq_slice_async_rq_store, &cfqd->cfq_slice_async_rq, 1,
 		UINT_MAX, 0);
+STORE_FUNCTION(cfq_ttime_valid_store, &cfqd->cfq_ttime_valid, 0, 2, 0);
 #undef STORE_FUNCTION
 
 #define CFQ_ATTR(name) \
@@ -2427,6 +2433,7 @@ static struct elv_fs_entry cfq_attrs[] = {
 	CFQ_ATTR(slice_async),
 	CFQ_ATTR(slice_async_rq),
 	CFQ_ATTR(slice_idle),
+	CFQ_ATTR(ttime_valid),
 	__ATTR_NULL
 };
 
diff --git a/include/linux/cfq-iosched.h b/include/linux/cfq-iosched.h
index 920bcb5..8fd4b59 100644
--- a/include/linux/cfq-iosched.h
+++ b/include/linux/cfq-iosched.h
@@ -95,6 +95,7 @@ struct cfq_data {
 	unsigned int cfq_slice[2];
 	unsigned int cfq_slice_async_rq;
 	unsigned int cfq_slice_idle;
+	unsigned int cfq_ttime_valid;
 
 	struct list_head cic_list;
 
-- 
1.5.6.5


_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list