Skip to content

Commit

Permalink
cgroup: rename cgroup_subsys->base_cftypes to ->legacy_cftypes
Browse files Browse the repository at this point in the history
Currently, cgroup_subsys->base_cftypes is used for both the unified
default hierarchy and legacy ones and subsystems can mark each file
with either CFTYPE_ONLY_ON_DFL or CFTYPE_INSANE if it has to appear
only on one of them.  This is quite hairy and error-prone.  Also, we
may end up exposing interface files to the default hierarchy without
thinking it through.

cgroup_subsys will grow two separate cftype arrays and apply each only
on the hierarchies of the matching type.  This will allow organizing
cftypes in a lot clearer way and encourage subsystems to scrutinize
the interface which is being exposed in the new default hierarchy.

In preparation, this patch renames cgroup_subsys->base_cftypes to
cgroup_subsys->legacy_cftypes.  This patch is pure rename.

Signed-off-by: Tejun Heo <[email protected]>
Acked-by: Neil Horman <[email protected]>
Acked-by: Li Zefan <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Vivek Goyal <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Aristeu Rozanski <[email protected]>
Cc: Aneesh Kumar K.V <[email protected]>
  • Loading branch information
htejun committed Jul 15, 2014
1 parent a14c687 commit 5577964
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion block/blk-cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ struct cgroup_subsys blkio_cgrp_subsys = {
.css_offline = blkcg_css_offline,
.css_free = blkcg_css_free,
.can_attach = blkcg_can_attach,
.base_cftypes = blkcg_files,
.legacy_cftypes = blkcg_files,
#ifdef CONFIG_MEMCG
/*
* This ensures that, if available, memcg is automatically enabled
Expand Down
2 changes: 1 addition & 1 deletion include/linux/cgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ struct cgroup_subsys {
struct list_head cfts;

/* base cftypes, automatically registered with subsys itself */
struct cftype *base_cftypes;
struct cftype *legacy_cftypes; /* used on the legacy hierarchies */

/*
* A subsystem may depend on other subsystems. When such subsystem
Expand Down
4 changes: 2 additions & 2 deletions kernel/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -4890,7 +4890,7 @@ int __init cgroup_init(void)
*/
if (!ss->disabled) {
cgrp_dfl_root.subsys_mask |= 1 << ss->id;
WARN_ON(cgroup_add_cftypes(ss, ss->base_cftypes));
WARN_ON(cgroup_add_cftypes(ss, ss->legacy_cftypes));
}
}

Expand Down Expand Up @@ -5480,6 +5480,6 @@ static struct cftype debug_files[] = {
struct cgroup_subsys debug_cgrp_subsys = {
.css_alloc = debug_css_alloc,
.css_free = debug_css_free,
.base_cftypes = debug_files,
.legacy_cftypes = debug_files,
};
#endif /* CONFIG_CGROUP_DEBUG */
2 changes: 1 addition & 1 deletion kernel/cgroup_freezer.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,5 +480,5 @@ struct cgroup_subsys freezer_cgrp_subsys = {
.css_free = freezer_css_free,
.attach = freezer_attach,
.fork = freezer_fork,
.base_cftypes = files,
.legacy_cftypes = files,
};
2 changes: 1 addition & 1 deletion kernel/cpuset.c
Original file line number Diff line number Diff line change
Expand Up @@ -2036,7 +2036,7 @@ struct cgroup_subsys cpuset_cgrp_subsys = {
.cancel_attach = cpuset_cancel_attach,
.attach = cpuset_attach,
.bind = cpuset_bind,
.base_cftypes = files,
.legacy_cftypes = files,
.early_init = 1,
};

Expand Down
2 changes: 1 addition & 1 deletion kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -8088,7 +8088,7 @@ struct cgroup_subsys cpu_cgrp_subsys = {
.can_attach = cpu_cgroup_can_attach,
.attach = cpu_cgroup_attach,
.exit = cpu_cgroup_exit,
.base_cftypes = cpu_files,
.legacy_cftypes = cpu_files,
.early_init = 1,
};

Expand Down
2 changes: 1 addition & 1 deletion kernel/sched/cpuacct.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,6 @@ void cpuacct_account_field(struct task_struct *p, int index, u64 val)
struct cgroup_subsys cpuacct_cgrp_subsys = {
.css_alloc = cpuacct_css_alloc,
.css_free = cpuacct_css_free,
.base_cftypes = files,
.legacy_cftypes = files,
.early_init = 1,
};
2 changes: 1 addition & 1 deletion mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -7048,7 +7048,7 @@ struct cgroup_subsys memory_cgrp_subsys = {
.cancel_attach = mem_cgroup_cancel_attach,
.attach = mem_cgroup_move_task,
.bind = mem_cgroup_bind,
.base_cftypes = mem_cgroup_files,
.legacy_cftypes = mem_cgroup_files,
.early_init = 0,
};

Expand Down
2 changes: 1 addition & 1 deletion net/core/netclassid_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,5 @@ struct cgroup_subsys net_cls_cgrp_subsys = {
.css_online = cgrp_css_online,
.css_free = cgrp_css_free,
.attach = cgrp_attach,
.base_cftypes = ss_files,
.legacy_cftypes = ss_files,
};
2 changes: 1 addition & 1 deletion net/core/netprio_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ struct cgroup_subsys net_prio_cgrp_subsys = {
.css_online = cgrp_css_online,
.css_free = cgrp_css_free,
.attach = net_prio_attach,
.base_cftypes = ss_files,
.legacy_cftypes = ss_files,
};

static int netprio_device_event(struct notifier_block *unused,
Expand Down
2 changes: 1 addition & 1 deletion security/device_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ struct cgroup_subsys devices_cgrp_subsys = {
.css_free = devcgroup_css_free,
.css_online = devcgroup_online,
.css_offline = devcgroup_offline,
.base_cftypes = dev_cgroup_files,
.legacy_cftypes = dev_cgroup_files,
};

/**
Expand Down

0 comments on commit 5577964

Please sign in to comment.