public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] CFQ:optimize the cfq_should_preempt()
@ 2009-06-09 10:59 Shan Wei
  2009-06-10 17:59 ` Jeff Moyer
  0 siblings, 1 reply; 3+ messages in thread
From: Shan Wei @ 2009-06-09 10:59 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel


The patch don't fix bug, just optimizes the cfq_should_preempt()
to preempt higher priority queue.

Additionally, the comment above cfq_preempt_queue() is outdated.


Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
---
 block/cfq-iosched.c |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index a55a9bd..427f522 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1993,10 +1993,10 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
 	if (cfq_slice_used(cfqq))
 		return 1;
 
-	if (cfq_class_idle(new_cfqq))
-		return 0;
-
-	if (cfq_class_idle(cfqq))
+	/*
+	 * if new_cfqq is of higher priority, preempting the active queue.
+	 */
+	if (new_cfqq->ioprio_class < cfqq->ioprio_class)
 		return 1;
 
 	/*
@@ -2013,12 +2013,6 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
 	if (rq_is_meta(rq) && !cfqq->meta_pending)
 		return 1;
 
-	/*
-	 * Allow an RT request to pre-empt an ongoing non-RT cfqq timeslice.
-	 */
-	if (cfq_class_rt(new_cfqq) && !cfq_class_rt(cfqq))
-		return 1;
-
 	if (!cfqd->active_cic || !cfq_cfqq_wait_request(cfqq))
 		return 0;
 
@@ -2033,8 +2027,7 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
 }
 
 /*
- * cfqq preempts the active queue. if we allowed preempt with no slice left,
- * let it have half of its nominal slice.
+ * cfqq preempts the active queue, and is set a new slice time.
  */
 static void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq)
 {

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

end of thread, other threads:[~2009-06-12  1:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-09 10:59 [PATCH] CFQ:optimize the cfq_should_preempt() Shan Wei
2009-06-10 17:59 ` Jeff Moyer
2009-06-12  1:19   ` Shan Wei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox