Skip to contentSkip to conversation

block cfq: select new workload if priority changed

PATCH Applied Shaohua Li 3 participants 4 messages Dec 9, 2010 – Dec 13, 2010 Block layer

lore
Share & tools
lore

Shaohua Li

author
#0 lore raw

PATCH 1/1 block cfq: select new workload if priority changed

If priority is changed, continue checking workload_expires and service tree count of previous workload is meaningless. We should always choose the workload with lowest key of new priority in such case.

---
 block/cfq-iosched.c |    5 +++++
 1 file changed, 5 insertions(+)
block/cfq-iosched.c +5 -0
Index: linux/block/cfq-iosched.c
===================================================================
@@ -2116,6 +2116,7 @@ static void choose_service_tree(struct c
 	unsigned count;
 	struct cfq_rb_root *st;
 	unsigned group_slice;
+	enum wl_prio_t original_prio = cfqd->serving_prio;
 
 	if (!cfqg) {
 		cfqd->serving_prio = IDLE_WORKLOAD;
@@ -2134,6 +2135,9 @@ static void choose_service_tree(struct c
 		return;
 	}
 
+	if (original_prio != cfqd->serving_prio)
+		goto new_workload;
+
 	/*
 	 * For RT and BE, we have to choose also the type
 	 * (SYNC, SYNC_NOIDLE, ASYNC), and to compute a workload
@@ -2148,6 +2152,7 @@ static void choose_service_tree(struct c
 	if (count && !time_after(jiffies, cfqd->workload_expires))
 		return;
 
+new_workload:
 	/* otherwise select new workload type */
 	cfqd->serving_type =
 		cfq_choose_wl(cfqd, cfqg, cfqd->serving_prio);
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Shaohua Li

If priority is changed, continue checking workload_expires and service tree count of previous workload is meaningless. We should always choose the workload

I'd change that first sentence to:

If priority is changed, continuing to check workload_expires and service tree count of the previous workload does not make sense.

Quoted 3 lines

with lowest key of new priority in such case.

This makes sense to me.

author Reviewed-by Jeff Moyer
#2 lore raw
Quoted 10 lines · Jeff Moyer
Quoted 2 lines · Shaohua Li

If priority is changed, continue checking workload_expires and service tree count of previous workload is meaningless. We should always choose the workload

I'd change that first sentence to:

If priority is changed, continuing to check workload_expires and service tree count of the previous workload does not make sense.

Quoted 7 lines
Quoted 3 lines

with lowest key of new priority in such case.

This makes sense to me.

Thanks, modified the the changelog.

If priority is changed, continuing to check workload_expires and service tree count of the previous workload does not make sense. We should always choose the workload with lowest key of new priority in such case.

---
 block/cfq-iosched.c |    5 +++++
 1 file changed, 5 insertions(+)
block/cfq-iosched.c +5 -0
Index: linux/block/cfq-iosched.c
===================================================================
@@ -2116,6 +2116,7 @@ static void choose_service_tree(struct c
 	unsigned count;
 	struct cfq_rb_root *st;
 	unsigned group_slice;
+	enum wl_prio_t original_prio = cfqd->serving_prio;
 
 	if (!cfqg) {
 		cfqd->serving_prio = IDLE_WORKLOAD;
@@ -2134,6 +2135,9 @@ static void choose_service_tree(struct c
 		return;
 	}
 
+	if (original_prio != cfqd->serving_prio)
+		goto new_workload;
+
 	/*
 	 * For RT and BE, we have to choose also the type
 	 * (SYNC, SYNC_NOIDLE, ASYNC), and to compute a workload
@@ -2148,6 +2152,7 @@ static void choose_service_tree(struct c
 	if (count && !time_after(jiffies, cfqd->workload_expires))
 		return;
 
+new_workload:
 	/* otherwise select new workload type */
 	cfqd->serving_type =
 		cfq_choose_wl(cfqd, cfqg, cfqd->serving_prio);
Applied
#3 lore raw
Quoted 11 lines · Shaohua Li
Quoted 10 lines · Jeff Moyer
Quoted 2 lines · Shaohua Li

If priority is changed, continue checking workload_expires and service tree count of previous workload is meaningless. We should always choose the workload

I'd change that first sentence to:

If priority is changed, continuing to check workload_expires and service tree count of the previous workload does not make sense.

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

with lowest key of new priority in such case.

This makes sense to me.

Thanks, modified the the changelog.

Thanks, applied to for-2.6.38/core

Signature · 1 line
Jens Axboe