Re: [PATCH -mm v2 3/7] cgroup: release css->id after css_free

From: Vladimir Davydov
Date: Mon Jan 19 2015 - 10:19:16 EST


Hi Tejun,

On Mon, Jan 19, 2015 at 09:30:01AM -0500, Tejun Heo wrote:
> On Mon, Jan 19, 2015 at 02:23:21PM +0300, Vladimir Davydov wrote:
> > Currently, we release css->id in css_release_work_fn, right before
> > calling css_free callback, so that when css_free is called, the id may
> > have already been reused for a new cgroup.
> >
> > I am going to use css->id to create unique names for per memcg kmem
> > caches. Since kmem caches are destroyed only on css_free, I need css->id
> > to be freed after css_free was called to avoid name clashes. This patch
> > therefore moves css->id removal to css_free_work_fn. To prevent
> > css_from_id from returning a pointer to a stale css, it makes
> > css_release_work_fn replace the css ptr at css_idr:css->id with NULL.
>
> I think it'd be better if you create a separate id for this purpose.
> The requirement is pretty unusual and likely contradictory with other
> usages.

Could you please elaborate this? I mean, what problems do you think can
arise if we release css->id a little bit (one grace period) later?

Of course, I can introduce yet another id per memcg, but I think we have
css->id to avoid code duplication in controllers.

Thanks,
Vladimir
--
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/