Re: [PATCH 1/2] cgroup: Add generation number with cgroup id

From: Namhyung Kim
Date: Sat Oct 26 2019 - 07:33:33 EST


Hi Tejun,

On Fri, Oct 25, 2019 at 7:57 PM Tejun Heo <tj@xxxxxxxxxx> wrote:
>
> Hello,
>
> On Fri, Oct 25, 2019 at 06:38:00PM +0900, Namhyung Kim wrote:
> > On Fri, Oct 25, 2019 at 5:30 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> > > > > /*
> > > > > * A cgroup_root represents the root of a cgroup hierarchy, and may be
> > > > > * associated with a kernfs_root to form an active hierarchy. This is
> > > > > @@ -521,7 +529,7 @@ struct cgroup_root {
> > > > > unsigned int flags;
> > > > >
> > > > > /* IDs for cgroups in this hierarchy */
> > > > > - struct idr cgroup_idr;
> > > > > + struct cgroup_idr cgroup_idr;
> > > >
> > > > Given that there's cgroup->self css, can we get rid of the above?
> > >
> > > I don't follow. Do you want to remove cgroup_idr and share the
> > > css_idr for cgroup id?
>
> Yeah, so, each cgroup has its own css at cgroup->self which has css id
> and everything, so I was wondering whether it'd make sense to get rid
> of the cgroup id and use cgroup->self.id in its place.

I think it's possible to use self.id as cgroup id. But css->id is managed
for each subsys, so it still needs to have an idr in cgroup_root for
cgroup->self.id, right?

Or do you want to get rid of subsys->idr and use a single idr for both
cgroup and css?

Thanks
Namhyung