diff options
author | Shaohua Li writes <shaohua.li@intel.com> | 2010-12-13 08:32:22 -0500 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-12-13 08:32:22 -0500 |
commit | e4ea0c16a85d221ebcc3a21f32e321440459e0fc (patch) | |
tree | 47acf4da84f9a448e6eb6172a5440ccc60696ed9 /block | |
parent | 760701bfe14faee8ea0608a9cab2046071d98a39 (diff) |
block cfq: select new workload if priority changed
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.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/cfq-iosched.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 5d0349d602fe..9b186fd6bf47 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -2101,6 +2101,7 @@ static void choose_service_tree(struct cfq_data *cfqd, struct cfq_group *cfqg) | |||
2101 | unsigned count; | 2101 | unsigned count; |
2102 | struct cfq_rb_root *st; | 2102 | struct cfq_rb_root *st; |
2103 | unsigned group_slice; | 2103 | unsigned group_slice; |
2104 | enum wl_prio_t original_prio = cfqd->serving_prio; | ||
2104 | 2105 | ||
2105 | if (!cfqg) { | 2106 | if (!cfqg) { |
2106 | cfqd->serving_prio = IDLE_WORKLOAD; | 2107 | cfqd->serving_prio = IDLE_WORKLOAD; |
@@ -2119,6 +2120,9 @@ static void choose_service_tree(struct cfq_data *cfqd, struct cfq_group *cfqg) | |||
2119 | return; | 2120 | return; |
2120 | } | 2121 | } |
2121 | 2122 | ||
2123 | if (original_prio != cfqd->serving_prio) | ||
2124 | goto new_workload; | ||
2125 | |||
2122 | /* | 2126 | /* |
2123 | * For RT and BE, we have to choose also the type | 2127 | * For RT and BE, we have to choose also the type |
2124 | * (SYNC, SYNC_NOIDLE, ASYNC), and to compute a workload | 2128 | * (SYNC, SYNC_NOIDLE, ASYNC), and to compute a workload |
@@ -2133,6 +2137,7 @@ static void choose_service_tree(struct cfq_data *cfqd, struct cfq_group *cfqg) | |||
2133 | if (count && !time_after(jiffies, cfqd->workload_expires)) | 2137 | if (count && !time_after(jiffies, cfqd->workload_expires)) |
2134 | return; | 2138 | return; |
2135 | 2139 | ||
2140 | new_workload: | ||
2136 | /* otherwise select new workload type */ | 2141 | /* otherwise select new workload type */ |
2137 | cfqd->serving_type = | 2142 | cfqd->serving_type = |
2138 | cfq_choose_wl(cfqd, cfqg, cfqd->serving_prio); | 2143 | cfq_choose_wl(cfqd, cfqg, cfqd->serving_prio); |