Re: [PATCH 12/24] io-controller: Wait for requests to complete fromlast queue before new queue is scheduled

From: Gui Jianfeng
Date: Sun Aug 23 2009 - 23:31:39 EST


Vivek Goyal wrote:
...
> void elv_schedule_dispatch(struct request_queue *q)
> @@ -2260,6 +2264,17 @@ void *elv_select_ioq(struct request_queue *q, int force)
> }
>
> expire:
> + if (efqd->fairness && !force && ioq && ioq->dispatched) {
> + /*
> + * If there are request dispatched from this queue, don't
> + * dispatch requests from new queue till all the requests from
> + * this queue have completed.
> + */
> + elv_log_ioq(efqd, ioq, "select: wait for requests to finish"
> + " disp=%lu", ioq->dispatched);
> + ioq = NULL;
> + goto keep_queue;
> + }
> elv_slice_expired(q);
> new_queue:
> ioq = elv_set_active_ioq(q, new_ioq);
> @@ -2375,6 +2390,10 @@ void elv_ioq_completed_request(struct request_queue *q, struct request *rq)
> goto done;
> }
>
> + /* Wait for requests to finish from this queue */
> + if (efqd->fairness && ioq->dispatched)

Since we have the routing to access to ioq->dispatched, why not to use it.

Signed-off-by: Gui Jianfeng <guijianfeng@xxxxxxxxxxxxxx>
---
block/elevator-fq.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/elevator-fq.c b/block/elevator-fq.c
index d04e925..f1e0de5 100644
--- a/block/elevator-fq.c
+++ b/block/elevator-fq.c
@@ -3120,7 +3120,7 @@ void elv_ioq_completed_request(struct request_queue *q, struct request *rq)
}

/* Wait for requests to finish from this queue */
- if (efqd->fairness && ioq->dispatched)
+ if (efqd->fairness && elv_ioq_nr_dispatched(ioq))
goto done;

/* Expire the queue */
@@ -3135,7 +3135,7 @@ void elv_ioq_completed_request(struct request_queue *q, struct request *rq)
* If this is the last queue in the group and we did not
* decide to idle on queue, idle on group.
*/
- if (elv_iog_should_idle(ioq) && !ioq->dispatched
+ if (elv_iog_should_idle(ioq) && !elv_ioq_nr_dispatched(ioq)
&& !timer_pending(&efqd->idle_slice_timer)) {
/*
* If queue has used up its slice, wait for the
--
1.5.4.rc3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/