[PATCH v2] cfq-iosched: avoid probable slice overrun when idling

From: Corrado Zoccolo
Date: Wed Oct 07 2009 - 17:18:33 EST


Idle timer is not armed if remaining slice is less than average think
time.

Signed-off-by: Corrado Zoccolo <czoccolo@xxxxxxxxx>
---
block/cfq-iosched.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index b35cc56..af1d621 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1099,6 +1099,14 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd)
if (!cic || !atomic_read(&cic->ioc->nr_tasks))
return;

+ /*
+ * think time is greater than remaining time slice
+ * don't idle, to avoid overrunnig the time slice
+ */
+ if (sample_valid(cic->ttime_samples) &&
+ (cfqq->slice_end - jiffies < cic->ttime_mean))
+ return;
+
cfq_mark_cfqq_wait_request(cfqq);

/*
--
1.6.2.5


--
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/