Commit e4ea0c16a85d221ebcc3a21f32e321440459e0fc

Authored by Shaohua Li writes
Committed by Jens Axboe
1 parent 760701bfe1

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>

Showing 1 changed file with 5 additions and 0 deletions Side-by-side Diff

... ... @@ -2101,6 +2101,7 @@
2101 2101 unsigned count;
2102 2102 struct cfq_rb_root *st;
2103 2103 unsigned group_slice;
  2104 + enum wl_prio_t original_prio = cfqd->serving_prio;
2104 2105  
2105 2106 if (!cfqg) {
2106 2107 cfqd->serving_prio = IDLE_WORKLOAD;
... ... @@ -2119,6 +2120,9 @@
2119 2120 return;
2120 2121 }
2121 2122  
  2123 + if (original_prio != cfqd->serving_prio)
  2124 + goto new_workload;
  2125 +
2122 2126 /*
2123 2127 * For RT and BE, we have to choose also the type
2124 2128 * (SYNC, SYNC_NOIDLE, ASYNC), and to compute a workload
... ... @@ -2133,6 +2137,7 @@
2133 2137 if (count && !time_after(jiffies, cfqd->workload_expires))
2134 2138 return;
2135 2139  
  2140 +new_workload:
2136 2141 /* otherwise select new workload type */
2137 2142 cfqd->serving_type =
2138 2143 cfq_choose_wl(cfqd, cfqg, cfqd->serving_prio);