Re: [PATCH 1/9] io-throttle documentation

From: Ryo Tsuruta
Date: Mon Apr 27 2009 - 08:15:46 EST


Hi Kamezawa-san,

> 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?

I have some questions.
- How about using the same numbering scheme as process ID for css_id
instead of idr? It prevents the same ID from being resued quickly.
- Why are css_ids assigned per css? If each cgroup has a unique ID and
the subsystems can refer to it, I can make the above code simple.

Thanks,
Ryo Tsuruta
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/