From patchwork Mon Aug 24 03:30:34 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gui Jianfeng X-Patchwork-Id: 43533 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7O3Vwc5005975 for ; Mon, 24 Aug 2009 03:31:58 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id B6514618EDC; Sun, 23 Aug 2009 23:31:56 -0400 (EDT) Received: from int-mx06.intmail.prod.int.phx2.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n7O3VpU5032635 for ; Sun, 23 Aug 2009 23:31:51 -0400 Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.5]) by int-mx06.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7O3Vi8g015097; Sun, 23 Aug 2009 23:31:44 -0400 Received: from song.cn.fujitsu.com (cn.fujitsu.com [222.73.24.84] (may be forged)) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7O3VXre008072; Sun, 23 Aug 2009 23:31:34 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 4DF8117008E; Mon, 24 Aug 2009 11:31:32 +0800 (CST) Received: from fnst.cn.fujitsu.com (localhost.localdomain [127.0.0.1]) by tang.cn.fujitsu.com (8.13.1/8.13.1) with ESMTP id n7O3eSa3027125; Mon, 24 Aug 2009 11:40:28 +0800 Received: from [127.0.0.1] (unknown [10.167.141.226]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id C80A7D40FE; Mon, 24 Aug 2009 11:36:10 +0800 (CST) Message-ID: <4A92095A.4070804@cn.fujitsu.com> Date: Mon, 24 Aug 2009 11:30:34 +0800 From: Gui Jianfeng User-Agent: Thunderbird 2.0.0.5 (Windows/20070716) MIME-Version: 1.0 To: Vivek Goyal References: <1250451046-9966-1-git-send-email-vgoyal@redhat.com> <1250451046-9966-13-git-send-email-vgoyal@redhat.com> In-Reply-To: <1250451046-9966-13-git-send-email-vgoyal@redhat.com> X-RedHat-Spam-Score: -1.283 (AWL,RDNS_NONE) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.19 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.5 X-loop: dm-devel@redhat.com Cc: dhaval@linux.vnet.ibm.com, peterz@infradead.org, dm-devel@redhat.com, dpshah@google.com, jens.axboe@oracle.com, agk@redhat.com, balbir@linux.vnet.ibm.com, paolo.valente@unimore.it, jmarchan@redhat.com, fernando@oss.ntt.co.jp, mikew@google.com, jmoyer@redhat.com, nauman@google.com, m-ikeda@ds.jp.nec.com, lizf@cn.fujitsu.com, fchecconi@gmail.com, s-uchida@ap.jp.nec.com, containers@lists.linux-foundation.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, righi.andrea@gmail.com Subject: [dm-devel] Re: [PATCH 12/24] io-controller: Wait for requests to complete from last queue before new queue is scheduled X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com 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 --- 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