From patchwork Fri Sep 18 03:56:56 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gui Jianfeng X-Patchwork-Id: 48449 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 n8I3xGhs031615 for ; Fri, 18 Sep 2009 03:59:16 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 5DA36618BCB; Thu, 17 Sep 2009 23:59:15 -0400 (EDT) Received: from int-mx02.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 n8I3xBqi005324 for ; Thu, 17 Sep 2009 23:59:11 -0400 Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.7]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8I3x7NZ005973; Thu, 17 Sep 2009 23:59:07 -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 n8I3wvOd006476; Thu, 17 Sep 2009 23:58:57 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 82B5A170080; Fri, 18 Sep 2009 11:58:56 +0800 (CST) Received: from fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id n8I3wfTN006499; Fri, 18 Sep 2009 11:58:41 +0800 Received: from [127.0.0.1] (unknown [10.167.141.226]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id A5DF8D4279; Fri, 18 Sep 2009 12:00:28 +0800 (CST) Message-ID: <4AB30508.6010206@cn.fujitsu.com> Date: Fri, 18 Sep 2009 11:56:56 +0800 From: Gui Jianfeng User-Agent: Thunderbird 2.0.0.5 (Windows/20070716) MIME-Version: 1.0 To: Vivek Goyal References: <1251495072-7780-1-git-send-email-vgoyal@redhat.com> <1251495072-7780-12-git-send-email-vgoyal@redhat.com> In-Reply-To: <1251495072-7780-12-git-send-email-vgoyal@redhat.com> X-RedHat-Spam-Score: -0.938 (AWL,RDNS_NONE) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.7 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, mingo@elte.hu, m-ikeda@ds.jp.nec.com, riel@redhat.com, lizf@cn.fujitsu.com, fchecconi@gmail.com, s-uchida@ap.jp.nec.com, KAMEZAWA Hiroyuki , containers@lists.linux-foundation.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, righi.andrea@gmail.com, torvalds@linux-foundation.org Subject: [dm-devel] [PATCH] io-controller: Fix another bug that causing system hanging 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: ... > * If io scheduler has functionality of keeping track of close cooperator, check > * with it if it has got a closely co-operating queue. > @@ -2057,6 +2171,7 @@ void *elv_select_ioq(struct request_queue *q, int force) > { > struct elv_fq_data *efqd = q->elevator->efqd; > struct io_queue *new_ioq = NULL, *ioq = elv_active_ioq(q->elevator); > + struct io_group *iog; > > if (!elv_nr_busy_ioq(q->elevator)) > return NULL; > @@ -2064,6 +2179,8 @@ void *elv_select_ioq(struct request_queue *q, int force) > if (ioq == NULL) > goto new_queue; > > + iog = ioq_to_io_group(ioq); > + > /* > * Force dispatch. Continue to dispatch from current queue as long > * as it has requests. > @@ -2075,11 +2192,47 @@ void *elv_select_ioq(struct request_queue *q, int force) > goto expire; > } > > + /* We are waiting for this group to become busy before it expires.*/ > + if (elv_iog_wait_busy(iog)) { > + ioq = NULL; > + goto keep_queue; > + } > + > /* > * The active queue has run out of time, expire it and select new. > */ > - if (elv_ioq_slice_used(ioq) && !elv_ioq_must_dispatch(ioq)) > - goto expire; > + if ((elv_ioq_slice_used(ioq) || elv_ioq_class_idle(ioq)) > + && !elv_ioq_must_dispatch(ioq)) { > + /* > + * Queue has used up its slice. Wait busy is not on otherwise > + * we wouldn't have been here. If this group will be deleted > + * after the queue expiry, then make sure we have onece > + * done wait busy on the group in an attempt to make it > + * backlogged. > + * > + * Following check helps in two conditions. > + * - If there are requests dispatched from the queue and > + * select_ioq() comes before a request completed from the > + * queue and got a chance to arm any of the idle timers. > + * > + * - If at request completion time slice had not expired and > + * we armed either a ioq timer or group timer but when > + * select_ioq() hits, slice has expired and it will expire > + * the queue without doing busy wait on group. > + * > + * In similar situations cfq lets delte the queue even if > + * idle timer is armed. That does not impact fairness in non > + * hierarhical setup due to weighted slice lengths. But in > + * hierarchical setup where group slice lengths are derived > + * from queue and is not proportional to group's weight, it > + * harms the fairness of the group. > + */ > + if (elv_iog_should_idle(ioq) && !elv_iog_wait_busy_done(iog)) { Hi Vivek, Here is another bug which will cause task hanging when accessing into a certain disk. For the moment, last ioq(corresponding CGroup has been removed) is optimized not to expire unitl another ioq get backlogged. Here just checking "iog_wait_busy_done" flag is not sufficient, because idle timer can be inactive at that moment. This will cause the ioq keeping service all the time and won't stop, causing the whole system hanging. This patch adds extra check for "iog_wait_busy" to make sure that the idle timer is pending, and this ioq will be expired after timer is up. Signed-off-by: Gui Jianfeng --- block/elevator-fq.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/block/elevator-fq.c b/block/elevator-fq.c index 40d0eb5..c039ba2 100644 --- a/block/elevator-fq.c +++ b/block/elevator-fq.c @@ -3364,7 +3364,8 @@ void *elv_select_ioq(struct request_queue *q, int force) * harms the fairness of the group. */ slice_expired = 1; - if (elv_iog_should_idle(ioq) && !elv_iog_wait_busy_done(iog)) { + if (elv_iog_should_idle(ioq) && !elv_iog_wait_busy_done(iog) && + elv_iog_wait_busy(iog)) { ioq = NULL; goto keep_queue; } else