Skip to contentSkip to conversation

CFQ ioprio setting patch

PATCH Vasily Tarasov 2 participants 2 messages May 29, 2006 – Jun 14, 2006 Block layer

lore
Share & tools
lore
#0 lore raw

If you set io-priority of process 1 using sys_ioprio_set system call by another process 2 (like ionice do),
then cfq_init_prio_data() function sets priority of process 2 (current) on queue of process 1 and clears the flag, that designates change of ioprio. So the process 1 will work like with priority of process 2.

I propose not to call cfq_init_prio_data() on io-priority change, but only mark queue as queue with changed prority. Every time when new request comes cfq-scheduler checks for this flag and atomaticaly changes priority of queue to new value.

Small patch is below.

block/cfq-iosched.c renamed from block/cfq-iosched.c.orig +0 -1
@@ -1325,7 +1325,6 @@ static inline void changed_ioprio(struct
 
 		spin_lock(cfqd->queue->queue_lock);
 		cfq_mark_cfqq_prio_changed(cfqq);
-		cfq_init_prio_data(cfqq);
 		spin_unlock(cfqd->queue->queue_lock);
 	}
 }
#1 lore raw
Quoted 10 lines · Vasily Tarasov

If you set io-priority of process 1 using sys_ioprio_set system call by another process 2 (like ionice do),
then cfq_init_prio_data() function sets priority of process 2 (current) on queue of process 1 and clears the flag, that designates change of ioprio. So the process 1 will work like with priority of process 2.

I propose not to call cfq_init_prio_data() on io-priority change, but only mark queue as queue with changed prority.
Every time when new request comes cfq-scheduler checks for this flag and atomaticaly changes priority of queue to new value.

Your analysis looks correct. However the patch is not -stable material, I've queued it for inclusion post 2.6.17, thanks. Newer version below for 2.6.17-rc6. If you have the time, please test that 2.6.17-rc6 has the same bug and that this patch (which is just a port of yours) does fix it.

block/cfq-iosched.c +2 -3
index 56bec4e..e636b0f 100644
@@ -1400,10 +1400,9 @@ static inline void changed_ioprio(struct
 			}
 		}
 		cfqq = cic->cfqq[SYNC];
-		if (cfqq) {
+		if (cfqq)
 			cfq_mark_cfqq_prio_changed(cfqq);
-			cfq_init_prio_data(cfqq);
-		}
+
 		spin_unlock(cfqd->queue->queue_lock);
 	}
 }
Signature · 1 line
Jens Axboe