From patchwork Tue Jul 7 01:40:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gui Jianfeng X-Patchwork-Id: 34369 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 n671fZZ2016884 for ; Tue, 7 Jul 2009 01:41:36 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 AE5CA6195D8; Mon, 6 Jul 2009 21:41:34 -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 n671fTdH022337 for ; Mon, 6 Jul 2009 21:41:29 -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 n671fSYh016581; Mon, 6 Jul 2009 21:41:28 -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 n671ehCZ003507; Mon, 6 Jul 2009 21:40:44 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 1250C17008D; Tue, 7 Jul 2009 09:51:15 +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 n6728Usq022329; Tue, 7 Jul 2009 10:08:31 +0800 Received: from [127.0.0.1] (unknown [10.167.141.226]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id A5EF4D4032; Tue, 7 Jul 2009 09:40:08 +0800 (CST) Message-ID: <4A52A77E.8050203@cn.fujitsu.com> Date: Tue, 07 Jul 2009 09:40:14 +0800 From: Gui Jianfeng User-Agent: Thunderbird 2.0.0.5 (Windows/20070716) MIME-Version: 1.0 To: Vivek Goyal References: <1246564917-19603-1-git-send-email-vgoyal@redhat.com> <1246564917-19603-10-git-send-email-vgoyal@redhat.com> <4A51657B.7000008@cn.fujitsu.com> <20090706141650.GD8279@redhat.com> In-Reply-To: <20090706141650.GD8279@redhat.com> X-RedHat-Spam-Score: -0.736 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] [PATCH] io-controller: Get rid of css id from io cgroup 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 Get rid of css id from io cgroup since it's nothing more than keeping track of iocg. An alternative is caching iocg pointer in io group, just remove the complexity. Signed-off-by: Gui Jianfeng --- block/elevator-fq.c | 36 ++++++++++++------------------------ block/elevator-fq.h | 2 +- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/block/elevator-fq.c b/block/elevator-fq.c index 7c83d1e..f499b54 100644 --- a/block/elevator-fq.c +++ b/block/elevator-fq.c @@ -191,25 +191,19 @@ static inline struct io_group *iog_parent(struct io_group *iog) #ifdef CONFIG_DEBUG_GROUP_IOSCHED static void io_group_path(struct io_group *iog, char *buf, int buflen) { - unsigned short id = iog->iocg_id; - struct cgroup_subsys_state *css; + struct io_cgroup *iocg; + int ret; rcu_read_lock(); - if (!id) + iocg = iog->iocg; + if (!iocg) goto out; - css = css_lookup(&io_subsys, id); - if (!css) - goto out; - - if (!css_tryget(css)) + ret = cgroup_path(iocg->css.cgroup, buf, buflen); + if (ret) goto out; - cgroup_path(css->cgroup, buf, buflen); - - css_put(css); - rcu_read_unlock(); return; out: @@ -1847,7 +1841,6 @@ struct cgroup_subsys io_subsys = { .destroy = iocg_destroy, .populate = iocg_populate, .subsys_id = io_subsys_id, - .use_id = 1, }; static inline unsigned int iog_weight(struct io_group *iog) @@ -1890,7 +1883,7 @@ io_group_chain_alloc(struct request_queue *q, void *key, struct cgroup *cgroup) if (!iog) goto cleanup; - iog->iocg_id = css_id(&iocg->css); + iog->iocg = iocg; sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor); iog->dev = MKDEV(major, minor); @@ -2201,7 +2194,7 @@ static struct io_group *io_alloc_root_group(struct request_queue *q, spin_lock_irq(&iocg->lock); rcu_assign_pointer(iog->key, key); hlist_add_head_rcu(&iog->group_node, &iocg->group_data); - iog->iocg_id = css_id(&iocg->css); + iog->iocg = iocg; spin_unlock_irq(&iocg->lock); #ifdef CONFIG_DEBUG_GROUP_IOSCHED @@ -2397,7 +2390,7 @@ remove_entry: group_node); efqd = rcu_dereference(iog->key); hlist_del_rcu(&iog->group_node); - iog->iocg_id = 0; + iog->iocg = NULL; spin_unlock_irqrestore(&iocg->lock, flags); spin_lock_irqsave(efqd->queue->queue_lock, flags); @@ -2411,7 +2404,6 @@ done: kfree(pn); } - free_css_id(&io_subsys, &iocg->css); rcu_read_unlock(); BUG_ON(!hlist_empty(&iocg->group_data)); kfree(iocg); @@ -2427,20 +2419,16 @@ static void io_group_check_and_destroy(struct elv_fq_data *efqd, { struct io_cgroup *iocg; unsigned long flags; - struct cgroup_subsys_state *css; rcu_read_lock(); - css = css_lookup(&io_subsys, iog->iocg_id); - - if (!css) + iocg = iog->iocg; + if (!iocg) goto out; - iocg = container_of(css, struct io_cgroup, css); - spin_lock_irqsave(&iocg->lock, flags); - if (iog->iocg_id) { + if (iog->iocg) { hlist_del_rcu(&iog->group_node); __io_destroy_group(efqd, iog); } diff --git a/block/elevator-fq.h b/block/elevator-fq.h index f089a55..75fee82 100644 --- a/block/elevator-fq.h +++ b/block/elevator-fq.h @@ -251,7 +251,7 @@ struct io_group { unsigned int busy_rt_queues; int deleting; - unsigned short iocg_id; + struct io_cgroup *iocg; /* The device MKDEV(major, minor), this group has been created for */ dev_t dev;