netcls_cgroup: move config inheritance to ->css_online() and remove .broken_hierarchy marking

It turns out that we'll have to live with attributes which are
inherited at cgroup creation time but not affected by further updates
to the parent afterwards - such attributes are already in wide use
e.g. for cpuset.

So, there's nothing to do for netcls_cgroup for hierarchy support.
Its current behavior - inherit only during creation - is good enough.

Move config inheriting from ->css_alloc() to ->css_online() for
consistency, which doesn't change behavior at all, and remove
.broken_hierarchy marking.

Signed-off-by: Tejun Heo <tj@kernel.org>
Tested-and-Acked-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Acked-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Tejun Heo 2012-11-22 07:32:46 -08:00
parent d0b2fdd2a5
commit 0ba18f7a5e

View File

@ -41,13 +41,17 @@ static struct cgroup_subsys_state *cgrp_css_alloc(struct cgroup *cgrp)
cs = kzalloc(sizeof(*cs), GFP_KERNEL);
if (!cs)
return ERR_PTR(-ENOMEM);
if (cgrp->parent)
cs->classid = cgrp_cls_state(cgrp->parent)->classid;
return &cs->css;
}
static int cgrp_css_online(struct cgroup *cgrp)
{
if (cgrp->parent)
cgrp_cls_state(cgrp)->classid =
cgrp_cls_state(cgrp->parent)->classid;
return 0;
}
static void cgrp_css_free(struct cgroup *cgrp)
{
kfree(cgrp_cls_state(cgrp));
@ -76,19 +80,11 @@ static struct cftype ss_files[] = {
struct cgroup_subsys net_cls_subsys = {
.name = "net_cls",
.css_alloc = cgrp_css_alloc,
.css_online = cgrp_css_online,
.css_free = cgrp_css_free,
.subsys_id = net_cls_subsys_id,
.base_cftypes = ss_files,
.module = THIS_MODULE,
/*
* While net_cls cgroup has the rudimentary hierarchy support of
* inheriting the parent's classid on cgroup creation, it doesn't
* properly propagates config changes in ancestors to their
* descendents. A child should follow the parent's configuration
* but be allowed to override it. Fix it and remove the following.
*/
.broken_hierarchy = true,
};
struct cls_cgroup_head {