Skip to contentSkip to conversation

cfq-iosched: Respect ioprio_class when preempting

PATCH In review Divyesh Shah 2 participants 2 messages Jan 7, 2010 – Jan 11, 2010 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cfq-iosched: Respect ioprio_class when preempting

In cfq_should_preempt(), we currently allow some cases where a non-RT request can preempt an ongoing RT cfqq timeslice. This should not happen. Examples include:

o A sync_noidle wl type non-RT request pre-empting a sync_noidle wl type cfqq on which we are idling.
o Once we have per-cgroup async queues, a non-RT sync request pre-empting a RT async cfqq.

---

 block/cfq-iosched.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
block/cfq-iosched.c +6 -0
index 7d6cef9..e9e6610 100644
@@ -3104,6 +3104,12 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
 		return true;
 
 	/*
+	 * Don't allow a non-RT request to preempt an ongoing RT cfqq timeslice.
+	 */
+	if (cfq_class_rt(cfqq) && !cfq_class_rt(new_cfqq))
+		return false;
+
+	/*
 	 * if the new request is sync, but the currently running queue is
 	 * not, let the sync request have priority.
 	 */
#1 lore raw
Quoted 20 lines · Divyesh Shah

In cfq_should_preempt(), we currently allow some cases where a non-RT request can preempt an ongoing RT cfqq timeslice. This should not happen. Examples include:

o A sync_noidle wl type non-RT request pre-empting a sync_noidle wl type cfqq on which we are idling.
o Once we have per-cgroup async queues, a non-RT sync request pre-empting a RT async cfqq.

---

 block/cfq-iosched.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
block/cfq-iosched.c +0 -0
index 7d6cef9..e9e6610 100644

block/cfq-iosched.c cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq, · line 3110

Quoted 7 lines
block/cfq-iosched.c +4 -0
@@ -3104,6 +3104,12 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
 		return true;
 
 	/*
+	 * Don't allow a non-RT request to preempt an ongoing RT cfqq timeslice.
+	 */
+	if (cfq_class_rt(cfqq) && !cfq_class_rt(new_cfqq))
+		return false;

It would be nice to just be able to do

        if (new_cfqq->ioprio_class > cfqq->ioprio_class)
                return false;

but that doesn't quite work given IOPRIO_CLASS_NONE < _RT. So I think your patch is fine, I've added it. Thanks.

Signature · 1 line
Jens Axboe