lkml.org 
[lkml]   [2009]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/9] io-throttle documentation
From
Hi Andrea,

From: Andrea Righi <righi.andrea@gmail.com>
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?

Thanks,
Ryo Tsuruta


\
 
 \ /
  Last update: 2009-04-27 12:49    [from the cache]
©2003-2011 Jasper Spaans