Skip to content

Commit 5577964

Browse files
committed
cgroup: rename cgroup_subsys->base_cftypes to ->legacy_cftypes
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 <tj@kernel.org> Acked-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: Li Zefan <lizefan@huawei.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@suse.cz> Cc: Vivek Goyal <vgoyal@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Aristeu Rozanski <aris@redhat.com> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
1 parent a14c687 commit 5577964

11 files changed

Lines changed: 12 additions & 12 deletions

File tree

‎block/blk-cgroup.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ struct cgroup_subsys blkio_cgrp_subsys = {
924924
.css_offline = blkcg_css_offline,
925925
.css_free = blkcg_css_free,
926926
.can_attach = blkcg_can_attach,
927-
.base_cftypes = blkcg_files,
927+
.legacy_cftypes = blkcg_files,
928928
#ifdef CONFIG_MEMCG
929929
/*
930930
* This ensures that, if available, memcg is automatically enabled

‎include/linux/cgroup.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ struct cgroup_subsys {
672672
struct list_head cfts;
673673

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

677677
/*
678678
* A subsystem may depend on other subsystems. When such subsystem

‎kernel/cgroup.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4890,7 +4890,7 @@ int __init cgroup_init(void)
48904890
*/
48914891
if (!ss->disabled) {
48924892
cgrp_dfl_root.subsys_mask |= 1 << ss->id;
4893-
WARN_ON(cgroup_add_cftypes(ss, ss->base_cftypes));
4893+
WARN_ON(cgroup_add_cftypes(ss, ss->legacy_cftypes));
48944894
}
48954895
}
48964896

@@ -5480,6 +5480,6 @@ static struct cftype debug_files[] = {
54805480
struct cgroup_subsys debug_cgrp_subsys = {
54815481
.css_alloc = debug_css_alloc,
54825482
.css_free = debug_css_free,
5483-
.base_cftypes = debug_files,
5483+
.legacy_cftypes = debug_files,
54845484
};
54855485
#endif /* CONFIG_CGROUP_DEBUG */

‎kernel/cgroup_freezer.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,5 +480,5 @@ struct cgroup_subsys freezer_cgrp_subsys = {
480480
.css_free = freezer_css_free,
481481
.attach = freezer_attach,
482482
.fork = freezer_fork,
483-
.base_cftypes = files,
483+
.legacy_cftypes = files,
484484
};

‎kernel/cpuset.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2036,7 +2036,7 @@ struct cgroup_subsys cpuset_cgrp_subsys = {
20362036
.cancel_attach = cpuset_cancel_attach,
20372037
.attach = cpuset_attach,
20382038
.bind = cpuset_bind,
2039-
.base_cftypes = files,
2039+
.legacy_cftypes = files,
20402040
.early_init = 1,
20412041
};
20422042

‎kernel/sched/core.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8088,7 +8088,7 @@ struct cgroup_subsys cpu_cgrp_subsys = {
80888088
.can_attach = cpu_cgroup_can_attach,
80898089
.attach = cpu_cgroup_attach,
80908090
.exit = cpu_cgroup_exit,
8091-
.base_cftypes = cpu_files,
8091+
.legacy_cftypes = cpu_files,
80928092
.early_init = 1,
80938093
};
80948094

‎kernel/sched/cpuacct.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,6 @@ void cpuacct_account_field(struct task_struct *p, int index, u64 val)
278278
struct cgroup_subsys cpuacct_cgrp_subsys = {
279279
.css_alloc = cpuacct_css_alloc,
280280
.css_free = cpuacct_css_free,
281-
.base_cftypes = files,
281+
.legacy_cftypes = files,
282282
.early_init = 1,
283283
};

‎mm/memcontrol.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7048,7 +7048,7 @@ struct cgroup_subsys memory_cgrp_subsys = {
70487048
.cancel_attach = mem_cgroup_cancel_attach,
70497049
.attach = mem_cgroup_move_task,
70507050
.bind = mem_cgroup_bind,
7051-
.base_cftypes = mem_cgroup_files,
7051+
.legacy_cftypes = mem_cgroup_files,
70527052
.early_init = 0,
70537053
};
70547054

‎net/core/netclassid_cgroup.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,5 @@ struct cgroup_subsys net_cls_cgrp_subsys = {
107107
.css_online = cgrp_css_online,
108108
.css_free = cgrp_css_free,
109109
.attach = cgrp_attach,
110-
.base_cftypes = ss_files,
110+
.legacy_cftypes = ss_files,
111111
};

‎net/core/netprio_cgroup.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ struct cgroup_subsys net_prio_cgrp_subsys = {
249249
.css_online = cgrp_css_online,
250250
.css_free = cgrp_css_free,
251251
.attach = net_prio_attach,
252-
.base_cftypes = ss_files,
252+
.legacy_cftypes = ss_files,
253253
};
254254

255255
static int netprio_device_event(struct notifier_block *unused,

0 commit comments

Comments
 (0)