From patchwork Thu Jun 11 08:10:55 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gui Jianfeng X-Patchwork-Id: 29497 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 n5B8Dfuo025812 for ; Thu, 11 Jun 2009 08:13:41 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 0EE0F6192C0; Thu, 11 Jun 2009 04:13:37 -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 n5B8DXbM022580 for ; Thu, 11 Jun 2009 04:13:33 -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 n5B8DWxX018942; Thu, 11 Jun 2009 04:13:32 -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 n5B8CkX8002415; Thu, 11 Jun 2009 04:12:48 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 87BCF170136; Thu, 11 Jun 2009 16:36:17 +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 n5B8QeNN017635; Thu, 11 Jun 2009 16:26:40 +0800 Received: from [127.0.0.1] (unknown [10.167.141.226]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id 4A61ED4032; Thu, 11 Jun 2009 16:12:47 +0800 (CST) Message-ID: <4A30BC0F.3000401@cn.fujitsu.com> Date: Thu, 11 Jun 2009 16:10:55 +0800 From: Gui Jianfeng User-Agent: Thunderbird 2.0.0.5 (Windows/20070716) MIME-Version: 1.0 To: Vivek Goyal References: <1244513342-11758-1-git-send-email-vgoyal@redhat.com> <1244513342-11758-11-git-send-email-vgoyal@redhat.com> In-Reply-To: <1244513342-11758-11-git-send-email-vgoyal@redhat.com> X-RedHat-Spam-Score: -0.728 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 Cc: dhaval@linux.vnet.ibm.com, snitzer@redhat.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, 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, akpm@linux-foundation.org, jbaron@redhat.com, linux-kernel@vger.kernel.org, s-uchida@ap.jp.nec.com, righi.andrea@gmail.com, containers@lists.linux-foundation.org Subject: [dm-devel] Re: [PATCH 10/19] io-conroller: Prepare elevator layer for single queue schedulers 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: ... > > /* > @@ -1296,6 +1302,13 @@ void io_group_chain_link(struct request_queue *q, void *key, > iog = io_cgroup_lookup_group(iocg, key); > io_group_set_parent(prev, iog); > } > + > + if (unlikely(efqd->only_root_group)) > + /* > + * TODO: Take care of force expiry of existing queue before > + * new queue is queued. > + */ > + efqd->only_root_group = 0; Hi Vivek, This flag isn't set back when all child groups go away. Am i missing something? BTW, why not just determine "only root group" by cgroup itself? Although there might be some impact if cgroup is built but no request goes into it. but i think this isn't a big deal. How about the following patch? Signed-off-by: Gui Jianfeng --- block/elevator-fq.c | 21 ++++++++++----------- block/elevator-fq.h | 1 - 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/block/elevator-fq.c b/block/elevator-fq.c index a516dce..f33155c 100644 --- a/block/elevator-fq.c +++ b/block/elevator-fq.c @@ -76,7 +76,6 @@ void elv_del_ioq_busy(struct elevator_queue *e, struct io_queue *ioq, void elv_activate_ioq(struct io_queue *ioq, int add_front); void elv_deactivate_ioq(struct elv_fq_data *efqd, struct io_queue *ioq, int requeue); - static int bfq_update_next_active(struct io_sched_data *sd) { struct io_group *iog; @@ -1131,6 +1130,14 @@ struct io_cgroup io_root_cgroup = { .ioprio_class = IO_DEFAULT_GRP_CLASS, }; +static int is_only_root_group(void) +{ + if (list_empty(&io_root_cgroup.css.cgroup->children)) + return 1; + + return 0; +} + void bfq_init_entity(struct io_entity *entity, struct io_group *iog) { entity->ioprio = entity->new_ioprio; @@ -1543,13 +1550,6 @@ void io_group_chain_link(struct request_queue *q, void *key, iog = io_cgroup_lookup_group(iocg, key); io_group_set_parent(prev, iog); } - - if (unlikely(efqd->only_root_group)) - /* - * TODO: Take care of force expiry of existing queue before - * new queue is queued. - */ - efqd->only_root_group = 0; } /** @@ -3601,7 +3601,7 @@ void *elv_fq_select_ioq(struct request_queue *q, int force) * overhead. */ - if (efqd->only_root_group && elv_iosched_single_ioq(q->elevator)) { + if (is_only_root_group() && elv_iosched_single_ioq(q->elevator)) { elv_log_ioq(efqd, ioq, "select: only root group, no expiry"); goto keep_queue; } @@ -3872,7 +3872,7 @@ void elv_ioq_completed_request(struct request_queue *q, struct request *rq) * unnecessary overhead. */ - if (efqd->only_root_group && + if (is_only_root_group() && elv_iosched_single_ioq(q->elevator)) { elv_log_ioq(efqd, ioq, "select: only root group," " no expiry"); @@ -4019,7 +4019,6 @@ int elv_init_fq_data(struct request_queue *q, struct elevator_queue *e) /* For the time being keep fairness enabled by default */ efqd->fairness = 1; - efqd->only_root_group = 1; return 0; } diff --git a/block/elevator-fq.h b/block/elevator-fq.h index 1b1fb0b..0939735 100644 --- a/block/elevator-fq.h +++ b/block/elevator-fq.h @@ -368,7 +368,6 @@ struct elv_fq_data { * queues. */ unsigned int fairness; - int only_root_group; }; extern int elv_slice_idle;