From patchwork Fri May 15 07:40:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gui Jianfeng X-Patchwork-Id: 26256 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 n4R0Sd6f010735 for ; Wed, 27 May 2009 00:28:39 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 BB8488E0164; Tue, 26 May 2009 20:28:38 -0400 (EDT) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n4F7fRTM018615 for ; Fri, 15 May 2009 03:41:27 -0400 Received: from mx3.redhat.com (mx3.redhat.com [172.16.48.32]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n4F7fPfd021039; Fri, 15 May 2009 03:41:25 -0400 Received: from song.cn.fujitsu.com (cn.fujitsu.com [222.73.24.84] (may be forged)) by mx3.redhat.com (8.13.8/8.13.8) with ESMTP id n4F7f4bP028058; Fri, 15 May 2009 03:41:05 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 31197170137; Fri, 15 May 2009 15:43:49 +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 n4F7fso9014480; Fri, 15 May 2009 15:41:54 +0800 Received: from [127.0.0.1] (unknown [10.167.141.226]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id 8B6B0D402F; Fri, 15 May 2009 15:50:29 +0800 (CST) Message-ID: <4A0D1C55.9040700@cn.fujitsu.com> Date: Fri, 15 May 2009 15:40:05 +0800 From: Gui Jianfeng User-Agent: Thunderbird 2.0.0.5 (Windows/20070716) MIME-Version: 1.0 To: Vivek Goyal References: <1241553525-28095-1-git-send-email-vgoyal@redhat.com> <4A03FF3C.4020506@cn.fujitsu.com> <20090508135724.GE7293@redhat.com> <4A078051.5060702@cn.fujitsu.com> <20090511154127.GD6036@redhat.com> In-Reply-To: <20090511154127.GD6036@redhat.com> X-RedHat-Spam-Score: -0.691 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-Scanned-By: MIMEDefang 2.63 on 172.16.48.32 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Tue, 26 May 2009 20:28:27 -0400 Cc: dhaval@linux.vnet.ibm.com, snitzer@redhat.com, dm-devel@redhat.com, dpshah@google.com, jens.axboe@oracle.com, agk@redhat.com, balbir@linux.vnet.ibm.com, paolo.valente@unimore.it, fernando@oss.ntt.co.jp, mikew@google.com, jmoyer@redhat.com, Nauman Rafique , 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] io-controller: Add io group reference handling for request 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: ... > Ok, here is the patch which gets rid of rq->iog and rq->rl fields. Good to > see some code and data structures trimming. It seems to be working fine for me. > > > o Get rid of rq->iog field and rq->rl fields. request descriptor stores > the pointer the the queue it belongs to (rq->ioq) and from the io queue one > can determine the group queue belongs to hence request belongs to. Thanks > to Nauman for the idea. > > o There are couple of places where rq->ioq information is not present yet > as request and queue are being setup. In those places "bio" is passed > around as function argument to determine the group rq will go into. I > did not pass "iog" as function argument becuase when memory is scarce, > we can release queue lock and sleep to wait for memory to become available > and once we wake up, it is possible that io group is gone. Passing bio > around helps that one shall have to remap bio to right group after waking > up. > > o Got rid of io_lookup_io_group_current() function and merged it with > io_get_io_group() to also take care of looking for group using current > task info and not from bio. Hi Vivek, This patch gets rid of "curr" from io_get_io_group, and seems to be working fine for me. Signed-off-by: Gui Jianfeng --- block/cfq-iosched.c | 12 ++++++------ block/elevator-fq.c | 16 ++++++++-------- block/elevator-fq.h | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index c0bb8db..bf87843 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -196,7 +196,7 @@ static struct cfq_queue *cic_bio_to_cfqq(struct cfq_data *cfqd, * async bio tracking is enabled and we are not caching * async queue pointer in cic. */ - iog = io_get_io_group(cfqd->queue, bio, 0, 0); + iog = io_get_io_group(cfqd->queue, bio, 0); if (!iog) { /* * May be this is first rq/bio and io group has not @@ -1294,7 +1294,7 @@ static void changed_cgroup(struct io_context *ioc, struct cfq_io_context *cic) spin_lock_irqsave(q->queue_lock, flags); - iog = io_get_io_group(q, NULL, 0, 1); + iog = io_get_io_group(q, NULL, 0); if (async_cfqq != NULL) { __iog = cfqq_to_io_group(async_cfqq); @@ -1346,9 +1346,9 @@ retry: * back. */ if (bio) - iog = io_get_io_group(q, bio, 1, 0); + iog = io_get_io_group(q, bio, 1); else - iog = io_get_io_group(q, NULL, 1, 1); + iog = io_get_io_group(q, NULL, 1); cic = cfq_cic_lookup(cfqd, ioc); /* cic always exists here */ @@ -1469,9 +1469,9 @@ cfq_get_queue(struct cfq_data *cfqd, struct bio *bio, int is_sync, struct io_group *iog = NULL; if (bio) - iog = io_get_io_group(cfqd->queue, bio, 1, 0); + iog = io_get_io_group(cfqd->queue, bio, 1); else - iog = io_get_io_group(cfqd->queue, NULL, 1, 1); + iog = io_get_io_group(cfqd->queue, NULL, 1); if (!is_sync) { async_cfqq = io_group_async_queue_prio(iog, ioprio_class, diff --git a/block/elevator-fq.c b/block/elevator-fq.c index 9b7319e..951c163 100644 --- a/block/elevator-fq.c +++ b/block/elevator-fq.c @@ -1006,7 +1006,7 @@ struct request_list *io_group_get_request_list(struct request_queue *q, { struct io_group *iog; - iog = io_get_io_group(q, bio, 1, 0); + iog = io_get_io_group(q, bio, 1); BUG_ON(!iog); return &iog->rl; } @@ -1470,7 +1470,7 @@ struct io_cgroup *get_iocg_from_bio(struct bio *bio) * */ struct io_group *io_get_io_group(struct request_queue *q, struct bio *bio, - int create, int curr) + int create) { struct cgroup *cgroup; struct io_group *iog; @@ -1478,7 +1478,7 @@ struct io_group *io_get_io_group(struct request_queue *q, struct bio *bio, rcu_read_lock(); - if (curr) + if (!bio) cgroup = task_cgroup(current, io_subsys_id); else cgroup = get_cgroup_from_bio(bio); @@ -1959,7 +1959,7 @@ int io_group_allow_merge(struct request *rq, struct bio *bio) return 1; /* Determine the io group of the bio submitting task */ - iog = io_get_io_group(q, bio, 0, 0); + iog = io_get_io_group(q, bio, 0); if (!iog) { /* May be task belongs to a differet cgroup for which io * group has not been setup yet. */ @@ -2000,9 +2000,9 @@ int elv_fq_set_request_ioq(struct request_queue *q, struct request *rq, retry: /* Determine the io group request belongs to */ if (bio) - iog = io_get_io_group(q, bio, 1, 0); + iog = io_get_io_group(q, bio, 1); else - iog = io_get_io_group(q, bio, 1, 1); + iog = io_get_io_group(q, NULL, 1); BUG_ON(!iog); @@ -2098,7 +2098,7 @@ struct io_queue *elv_lookup_ioq_bio(struct request_queue *q, struct bio *bio) struct io_group *iog; /* lookup the io group and io queue of the bio submitting task */ - iog = io_get_io_group(q, bio, 0, 0); + iog = io_get_io_group(q, bio, 0); if (!iog) { /* May be bio belongs to a cgroup for which io group has * not been setup yet. */ @@ -2159,7 +2159,7 @@ struct io_group *io_lookup_io_group_current(struct request_queue *q) EXPORT_SYMBOL(io_lookup_io_group_current); struct io_group *io_get_io_group(struct request_queue *q, struct bio *bio, - int create, int curr) + int create) { return q->elevator->efqd.root_group; } diff --git a/block/elevator-fq.h b/block/elevator-fq.h index 8d190ab..d8d8f61 100644 --- a/block/elevator-fq.h +++ b/block/elevator-fq.h @@ -657,7 +657,7 @@ extern void io_group_set_async_queue(struct io_group *iog, int ioprio_class, int ioprio, struct io_queue *ioq); extern struct io_group *io_lookup_io_group_current(struct request_queue *q); extern struct io_group *io_get_io_group(struct request_queue *q, - struct bio *bio, int create, int curr); + struct bio *bio, int create); extern int elv_nr_busy_ioq(struct elevator_queue *e); extern int elv_nr_busy_rt_ioq(struct elevator_queue *e); extern struct io_queue *elv_alloc_ioq(struct request_queue *q, gfp_t gfp_mask);