Skip to contentSkip to conversation

cfq: enable idle for seeky processes on rotational NCQ devices

PATCH In review Corrado Zoccolo 2 participants 2 messages Oct 3, 2009 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cfq: enable idle for seeky processes on rotational NCQ devices

Idle window is currently disabled for seeky processes on all NCQ devices. This is causing large latencies when seeky processes are competing with async writes, for rotational NCQ devices.

This patch, based on Vivek Goyal's original idea (http://lkml.org/lkml/2009/7/12/110),
enables idle window for seeky processes on rotational NCQ devices.
As for non-NCQ devices, a smaller idle window (2ms) is used
for seeky processes compared to normal I/O (8ms).

RAIDs should be marked as non-rotational as well (and probably a better flag name should be devised), since they can carry multiple operations in parallel.

---

block/cfq-iosched.c +4 -2
index 1ca813b..7116f11 100644
@@ -1951,10 +1951,12 @@ cfq_update_idle_window(struct cfq_data *cfqd, struct cfq_queue *cfqq,
 	enable_idle = old_idle = cfq_cfqq_idle_window(cfqq);
 
 	if (!atomic_read(&cic->ioc->nr_tasks) || !cfqd->cfq_slice_idle ||
-	    (cfqd->hw_tag && CIC_SEEKY(cic)))
+	    (blk_queue_nonrot(cfqd->queue) && cfqd->hw_tag && CIC_SEEKY(cic)))
 		enable_idle = 0;
 	else if (sample_valid(cic->ttime_samples)) {
-		if (cic->ttime_mean > cfqd->cfq_slice_idle)
+		unsigned idle_time = CIC_SEEKY(cic) ? CFQ_MIN_TT
+			: cfqd->cfq_slice_idle;
+		if (cic->ttime_mean > idle_time)
 			enable_idle = 0;
 		else
 			enable_idle = 1;
#1 lore raw
Quoted 23 lines · Corrado Zoccolo

Idle window is currently disabled for seeky processes on all NCQ devices. This is causing large latencies when seeky processes are competing with async writes, for rotational NCQ devices.

This patch, based on Vivek Goyal's original idea (http://lkml.org/lkml/2009/7/12/110),
enables idle window for seeky processes on rotational NCQ devices.
As for non-NCQ devices, a smaller idle window (2ms) is used
for seeky processes compared to normal I/O (8ms).

RAIDs should be marked as non-rotational as well (and probably a better flag name should be devised), since they can carry multiple operations in parallel.

---

block/cfq-iosched.c +0 -1
index 1ca813b..7116f11 100644
@@ -1951,10 +1951,12 @@ cfq_update_idle_window(struct cfq_data *cfqd, struct cfq_queue *cfqq,
 	enable_idle = old_idle = cfq_cfqq_idle_window(cfqq);
 
 	if (!atomic_read(&cic->ioc->nr_tasks) || !cfqd->cfq_slice_idle ||
-	    (cfqd->hw_tag && CIC_SEEKY(cic)))

block/cfq-iosched.c cfq_update_idle_window(struct cfq_data *cfqd, struct cfq_queue *cfqq, · line 1962

Quoted 10 lines
block/cfq-iosched.c +4 -1
+	    (blk_queue_nonrot(cfqd->queue) && cfqd->hw_tag && CIC_SEEKY(cic)))
 		enable_idle = 0;
 	else if (sample_valid(cic->ttime_samples)) {
-		if (cic->ttime_mean > cfqd->cfq_slice_idle)
+		unsigned idle_time = CIC_SEEKY(cic) ? CFQ_MIN_TT
+			: cfqd->cfq_slice_idle;
+		if (cic->ttime_mean > idle_time)
 			enable_idle = 0;
 		else
 			enable_idle = 1;

Please don't use the ?: constructs, they are not very readable (especially not with multi-lines).

Can you resend this on top of the current for-linus branch, it has a few cfq patches that cause this not to apply anyway.

Signature · 1 line
Jens Axboe