All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch]block,cfq: change code order
@ 2012-01-19  2:08 Shaohua Li
  2012-01-19  8:18 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Shaohua Li @ 2012-01-19  2:08 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Tetsuo Handa, lkml

Subject: block,cfq: change code order

cfq_slice_expired will change saved_workload_slice. It should be called
first so saved_workload_slice is correctly set to 0 after workload type
is changed.
This fixes the code order changed by 54b466e44b1c7.

Tested-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index ee55019..da21c24 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -3117,17 +3117,18 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
  */
 static void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq)
 {
+	enum wl_type_t old_type = cfqq_type(cfqd->active_queue);
+
 	cfq_log_cfqq(cfqd, cfqq, "preempt");
+	cfq_slice_expired(cfqd, 1);
 
 	/*
 	 * workload type is changed, don't save slice, otherwise preempt
 	 * doesn't happen
 	 */
-	if (cfqq_type(cfqd->active_queue) != cfqq_type(cfqq))
+	if (old_type != cfqq_type(cfqq))
 		cfqq->cfqg->saved_workload_slice = 0;
 
-	cfq_slice_expired(cfqd, 1);
-
 	/*
 	 * Put the new queue at the front of the of the current list,
 	 * so we know that it will be selected next.



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch]block,cfq: change code order
  2012-01-19  2:08 [patch]block,cfq: change code order Shaohua Li
@ 2012-01-19  8:18 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2012-01-19  8:18 UTC (permalink / raw)
  To: Shaohua Li; +Cc: Tetsuo Handa, lkml

On 01/19/2012 03:08 AM, Shaohua Li wrote:
> Subject: block,cfq: change code order
> 
> cfq_slice_expired will change saved_workload_slice. It should be called
> first so saved_workload_slice is correctly set to 0 after workload type
> is changed.
> This fixes the code order changed by 54b466e44b1c7.

Thanks, applied.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-19  8:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-19  2:08 [patch]block,cfq: change code order Shaohua Li
2012-01-19  8:18 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.