From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrea Righi Subject: Re: [PATCH 1/9] io-throttle documentation Date: Mon, 27 Apr 2009 23:56:52 +0200 Message-ID: <20090427215650.GB3606@linux> References: <20090417102539.GA16838@linux> <20090420.183815.226804723.ryov@valinux.co.jp> <20090420150052.GC13307@linux> <20090427.194533.183037823.ryov@valinux.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20090427.194533.183037823.ryov-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Ryo Tsuruta Cc: randy.dunlap-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org, menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, chlunde-om2ZC0WAoZIXWF+eFR7m5Q@public.gmane.org, eric.rannaud-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, balbir-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org, fernando-gVGce1chcLdL9jVzuh4AOg@public.gmane.org, dradford-cT2on/YLNlBWk0Htik3J/w@public.gmane.org, agk-9JcytcrH/bA+uJoB2kUjGw@public.gmane.org, subrata-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org, axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org, matt-cT2on/YLNlBWk0Htik3J/w@public.gmane.org, roberto-5KDOxZqKugI@public.gmane.org, ngupta-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org List-Id: containers.vger.kernel.org On Mon, Apr 27, 2009 at 07:45:33PM +0900, Ryo Tsuruta wrote: > Hi Andrea, > > From: Andrea Righi > Subject: Re: [PATCH 1/9] io-throttle documentation > Date: Mon, 20 Apr 2009 17:00:53 +0200 > > > On Mon, Apr 20, 2009 at 06:38:15PM +0900, Ryo Tsuruta wrote: > > > Hi Andrea, > > > > > > > Implementing bio-cgroup functionality as pure infrastructure framework > > > > instead of a cgroup subsystem would remove all this oddity and > > > > complexity. > > > > > > > > For example, the actual functionality that I need for the io-throttle > > > > controller is just an interface to set and get the cgroup owner of a > > > > page. I think it should be the same also for other potential users of > > > > bio-cgroup. > > > > > > > > So, what about implementing the bio-cgroup functionality as cgroup "page > > > > tracking" infrastructure and provide the following interfaces: > > > > > > > > /* > > > > * Encode the cgrp->css.id in page_group->flags > > > > */ > > > > void set_cgroup_page_owner(struct page *page, struct cgroup *cgrp); > > > > > > > > /* > > > > * Returns the cgroup owner of a page, decoding the cgroup id from > > > > * page_cgroup->flags. > > > > */ > > > > struct cgroup *get_cgroup_page_owner(struct page *page); > > > > > > > > This also wouldn't increase the size of page_cgroup because we can > > > > encode the cgroup id in the unused bits of page_cgroup->flags, as > > > > originally suggested by Kame. > > > > > > > > And I think it could be used also by dm-ioband, even if it's not a > > > > cgroup-based subsystem... but I may be wrong. Ryo what's your opinion? > > I've come up with an idea to coexist blkio-cgroup and io-throttle. > blkio-cgroup provides a function to get a cgroup with the specified ID. > > /* Should be called under rcu_read_lock() */ > struct cgroup *blkio_cgroup_lookup(int id) > { > struct cgroup *cgrp; > struct cgroup_subsys_state *css; > > if (blkio_cgroup_disabled()) > return NULL; > > css = css_lookup(&blkio_cgroup_subsys, id); > if (!css) > return NULL; > cgrp = css->cgroup; > return cgrp; > } > > Then io-throttle can get a struct iothrottle which belongs to the > cgroup by using the above function. > > static struct iothrottle *iothrottle_lookup(int id) > { > struct cgroup *grp; > struct iothrottle *iot; > > ... > grp = blkio_cgroup_lookup(id); > if (!grp) > return NULL > iot = cgroup_to_iothrottle(grp); > ... > } > > What do you think about this way? Hi Ryo, this should be ok for io-throttle. But I'd still prefer to see blkio-cgroup implemented as an infrastructure, instead of a cgroup. This would avoid (at least for io-throttle) the need to mount io-throttle together with blkio-cgroup or provide complicate ways to associate io-throttle groups with blkio-cgroup groups. Thanks, -Andrea From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761009AbZD0V67 (ORCPT ); Mon, 27 Apr 2009 17:58:59 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760249AbZD0V5A (ORCPT ); Mon, 27 Apr 2009 17:57:00 -0400 Received: from mail-fx0-f158.google.com ([209.85.220.158]:46975 "EHLO mail-fx0-f158.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760608AbZD0V46 (ORCPT ); Mon, 27 Apr 2009 17:56:58 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=CrkKJ009zmMW6UUGzQuFaoz3gQ/r1owP1XsH2BZg1Kll70pxs8TLPUraGGoE6e3/RF u8XnU/1mNZ1TNSKUgRnYpaHdPcE9lcWGg0qNDPC3e7B3/IUC5ILFAzeOGayRHx+m2owm 8qR7YSFujdUg6ceT1XlFpuudwPqeJzRtKULsI= Date: Mon, 27 Apr 2009 23:56:52 +0200 From: Andrea Righi To: Ryo Tsuruta Cc: lizf@cn.fujitsu.com, kamezawa.hiroyu@jp.fujitsu.com, menage@google.com, balbir@linux.vnet.ibm.com, guijianfeng@cn.fujitsu.com, agk@sourceware.org, akpm@linux-foundation.org, axboe@kernel.dk, baramsori72@gmail.com, chlunde@ping.uio.no, dave@linux.vnet.ibm.com, dpshah@google.com, eric.rannaud@gmail.com, fernando@oss.ntt.co.jp, taka@valinux.co.jp, matt@bluehost.com, dradford@bluehost.com, ngupta@google.com, randy.dunlap@oracle.com, roberto@unbit.it, s-uchida@ap.jp.nec.com, subrata@linux.vnet.ibm.com, yoshikawa.takuya@oss.ntt.co.jp, containers@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/9] io-throttle documentation Message-ID: <20090427215650.GB3606@linux> References: <20090417102539.GA16838@linux> <20090420.183815.226804723.ryov@valinux.co.jp> <20090420150052.GC13307@linux> <20090427.194533.183037823.ryov@valinux.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090427.194533.183037823.ryov@valinux.co.jp> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 27, 2009 at 07:45:33PM +0900, Ryo Tsuruta wrote: > Hi Andrea, > > From: Andrea Righi > Subject: Re: [PATCH 1/9] io-throttle documentation > Date: Mon, 20 Apr 2009 17:00:53 +0200 > > > On Mon, Apr 20, 2009 at 06:38:15PM +0900, Ryo Tsuruta wrote: > > > Hi Andrea, > > > > > > > Implementing bio-cgroup functionality as pure infrastructure framework > > > > instead of a cgroup subsystem would remove all this oddity and > > > > complexity. > > > > > > > > For example, the actual functionality that I need for the io-throttle > > > > controller is just an interface to set and get the cgroup owner of a > > > > page. I think it should be the same also for other potential users of > > > > bio-cgroup. > > > > > > > > So, what about implementing the bio-cgroup functionality as cgroup "page > > > > tracking" infrastructure and provide the following interfaces: > > > > > > > > /* > > > > * Encode the cgrp->css.id in page_group->flags > > > > */ > > > > void set_cgroup_page_owner(struct page *page, struct cgroup *cgrp); > > > > > > > > /* > > > > * Returns the cgroup owner of a page, decoding the cgroup id from > > > > * page_cgroup->flags. > > > > */ > > > > struct cgroup *get_cgroup_page_owner(struct page *page); > > > > > > > > This also wouldn't increase the size of page_cgroup because we can > > > > encode the cgroup id in the unused bits of page_cgroup->flags, as > > > > originally suggested by Kame. > > > > > > > > And I think it could be used also by dm-ioband, even if it's not a > > > > cgroup-based subsystem... but I may be wrong. Ryo what's your opinion? > > I've come up with an idea to coexist blkio-cgroup and io-throttle. > blkio-cgroup provides a function to get a cgroup with the specified ID. > > /* Should be called under rcu_read_lock() */ > struct cgroup *blkio_cgroup_lookup(int id) > { > struct cgroup *cgrp; > struct cgroup_subsys_state *css; > > if (blkio_cgroup_disabled()) > return NULL; > > css = css_lookup(&blkio_cgroup_subsys, id); > if (!css) > return NULL; > cgrp = css->cgroup; > return cgrp; > } > > Then io-throttle can get a struct iothrottle which belongs to the > cgroup by using the above function. > > static struct iothrottle *iothrottle_lookup(int id) > { > struct cgroup *grp; > struct iothrottle *iot; > > ... > grp = blkio_cgroup_lookup(id); > if (!grp) > return NULL > iot = cgroup_to_iothrottle(grp); > ... > } > > What do you think about this way? Hi Ryo, this should be ok for io-throttle. But I'd still prefer to see blkio-cgroup implemented as an infrastructure, instead of a cgroup. This would avoid (at least for io-throttle) the need to mount io-throttle together with blkio-cgroup or provide complicate ways to associate io-throttle groups with blkio-cgroup groups. Thanks, -Andrea