Re: [RFC][PATCH 1/4] cgroup: support per cgroup subsys state ID(CSS ID)

From: KAMEZAWA Hiroyuki
Date: Thu Jan 15 2009 - 01:13:23 EST


Sorry for delayed reply.


On Mon, 12 Jan 2009 12:51:48 +0530
Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx> wrote:

> * KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> [2009-01-08 18:28:17]:
> > There are several reasons to develop this.
> > - Saving space .... For example, memcg's swap_cgroup is array of
> > pointers to cgroup. But it is not necessary to be very fast.
> > By replacing pointers(8bytes per ent) to ID (2byes per ent), we can
> > reduce much amount of memory usage.
>
> 2 bytes per entry means that we restrict the entries to 2^16-1 for
> number of cgroups, using a pointer introduces no such restriction.
> 2^16-1 seems a reasonable number for now.
>
yes.


> > /* bits in struct cgroup_subsys_state flags field */
> > @@ -363,6 +367,11 @@ struct cgroup_subsys {
> > int active;
> > int disabled;
> > int early_init;
> > + /*
> > + * True if this subsys uses ID. ID is not available before cgroup_init()
> > + * (not available in early_init time.)
> ^ period should come later
sure.

;
> > + /*
> > + * Hierarchy of CSS ID belongs to.
> > + */
> > + unsigned short stack[0]; /* Array of Length (depth+1) */
>
> By maintaining the path up to the root here, is that how we avoid walking
> through cgroups links?
>
yes. we can check this css is under hierarchy by

css->stack[root->depth] == root->id.


> > +/**
> > * idr_replace - replace pointer for given id
> > * @idp: idr handle
> > * @ptr: pointer you want associated with the id
> >
>
> Overall, I've taken a quick look and the patches seem OK.
>
thx,

-Kame

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