From: Shan Wei <shanwei@cn.fujitsu.com>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] CFQ:optimize the cfq_should_preempt()
Date: Tue, 09 Jun 2009 18:59:20 +0800 [thread overview]
Message-ID: <4A2E4088.1010403@cn.fujitsu.com> (raw)
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)
{
next reply other threads:[~2009-06-09 11:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-09 10:59 Shan Wei [this message]
2009-06-10 17:59 ` [PATCH] CFQ:optimize the cfq_should_preempt() Jeff Moyer
2009-06-12 1:19 ` Shan Wei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A2E4088.1010403@cn.fujitsu.com \
--to=shanwei@cn.fujitsu.com \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox