mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: axboe@suse.de
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH Linux 2.6.12-rc4-mm2 01/03] cfq: cfq ELEVATOR_INSERT_BACK fix
Date: Wed, 25 May 2005 01:35:24 +0900 (KST)	[thread overview]
Message-ID: <20050524163518.B14862D0@htj.dyndns.org> (raw)
In-Reply-To: <20050524163518.0DA61D6C@htj.dyndns.org>

01_cfq_INSERT_BACK_fix.patch

	When inserting INSERT_BACK request, cfq_insert_request() calls
	cfq_dispatch_requests() repetitively until it returns zero
	indicating no request is dispatched.  This used to flush all
	the requests in the queue to the dispatch queue but, with idle
	slice implemented, the current active queue may decide to wait
	for new request using slice_timer.  When this happens, 0 is
	returned from cfq_dispatch_requests() even when other cfqq's
	have pending requests.  This breaks INSRET_BACK semantics.

	This patch adds @force argument which, when set to non-zero,
	disables idle_slice, and uses the argument when flushing
	cfqq's for INSERT_BACK.  While at it, use INT_MAX instead of
	cfq_quantum when flushing cfqq's, as we're gonna dump all the
	requests and using cfq_quantum does nothing but adding
	unnecessary iterations.

Signed-off-by: Tejun Heo <htejun@gmail.com>

 cfq-iosched.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

Index: blk-fixes/drivers/block/cfq-iosched.c
===================================================================
--- blk-fixes.orig/drivers/block/cfq-iosched.c	2005-05-25 01:35:16.000000000 +0900
+++ blk-fixes/drivers/block/cfq-iosched.c	2005-05-25 01:35:16.000000000 +0900
@@ -991,7 +991,7 @@ cfq_prio_to_maxrq(struct cfq_data *cfqd,
 /*
  * get next queue for service
  */
-static struct cfq_queue *cfq_select_queue(struct cfq_data *cfqd)
+static struct cfq_queue *cfq_select_queue(struct cfq_data *cfqd, int force)
 {
 	unsigned long now = jiffies;
 	struct cfq_queue *cfqq;
@@ -1012,7 +1012,8 @@ static struct cfq_queue *cfq_select_queu
 	 */
 	if (!RB_EMPTY(&cfqq->sort_list))
 		goto keep_queue;
-	else if (cfq_cfqq_sync(cfqq) && time_before(now, cfqq->slice_end)) {
+	else if (!force && cfq_cfqq_sync(cfqq) &&
+		 time_before(now, cfqq->slice_end)) {
 		if (cfq_arm_slice_timer(cfqd, cfqq))
 			return NULL;
 	}
@@ -1078,7 +1079,8 @@ __cfq_dispatch_requests(struct cfq_data 
 	return dispatched;
 }
 
-static int cfq_dispatch_requests(request_queue_t *q, int max_dispatch)
+static int
+cfq_dispatch_requests(request_queue_t *q, int max_dispatch, int force)
 {
 	struct cfq_data *cfqd = q->elevator->elevator_data;
 	struct cfq_queue *cfqq;
@@ -1086,7 +1088,7 @@ static int cfq_dispatch_requests(request
 	if (!cfqd->busy_queues)
 		return 0;
 
-	cfqq = cfq_select_queue(cfqd);
+	cfqq = cfq_select_queue(cfqd, force);
 	if (cfqq) {
 		cfqq->wait_request = 0;
 		cfqq->must_dispatch = 0;
@@ -1172,7 +1174,7 @@ dispatch:
 		return rq;
 	}
 
-	if (cfq_dispatch_requests(q, cfqd->cfq_quantum))
+	if (cfq_dispatch_requests(q, cfqd->cfq_quantum, 0))
 		goto dispatch;
 
 	return NULL;
@@ -1707,7 +1709,7 @@ cfq_insert_request(request_queue_t *q, s
 
 	switch (where) {
 		case ELEVATOR_INSERT_BACK:
-			while (cfq_dispatch_requests(q, cfqd->cfq_quantum))
+			while (cfq_dispatch_requests(q, INT_MAX, 1))
 				;
 			list_add_tail(&rq->queuelist, &q->queue_head);
 			break;


  reply	other threads:[~2005-05-24 16:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-24 16:35 [PATCH Linux 2.6.12-rc4-mm2 00/03] cfq: various fixes Tejun Heo
2005-05-24 16:35 ` Tejun Heo [this message]
2005-05-24 16:35 ` [PATCH Linux 2.6.12-rc4-mm2 02/03] cfq: cfq_io_context leak fix Tejun Heo
2005-05-24 16:35 ` [PATCH Linux 2.6.12-rc4-mm2 03/03] cfq: remove serveral unused fields from cfq data structures Tejun Heo
2005-05-25  7:34 ` [PATCH Linux 2.6.12-rc4-mm2 00/03] cfq: various fixes Jens Axboe

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=20050524163518.B14862D0@htj.dyndns.org \
    --to=htejun@gmail.com \
    --cc=axboe@suse.de \
    --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

all inboxes | Powered by JetHome®