aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-cgroup.c9
-rw-r--r--kernel/cgroup.c10
-rw-r--r--kernel/cgroup_freezer.c11
-rw-r--r--kernel/cpuset.c31
-rw-r--r--kernel/sched/core.c16
-rw-r--r--net/core/netprio_cgroup.c8
-rw-r--r--net/sched/cls_cgroup.c8
-rw-r--r--security/device_cgroup.c10
8 files changed, 28 insertions, 75 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 60ef16d6d155..126c341955de 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1515,14 +1515,9 @@ struct cftype blkio_files[] = {
1515 .read_map = blkiocg_file_read_map, 1515 .read_map = blkiocg_file_read_map,
1516 }, 1516 },
1517#endif 1517#endif
1518 { } /* terminate */
1518}; 1519};
1519 1520
1520static int blkiocg_populate(struct cgroup_subsys *subsys, struct cgroup *cgroup)
1521{
1522 return cgroup_add_files(cgroup, subsys, blkio_files,
1523 ARRAY_SIZE(blkio_files));
1524}
1525
1526static void blkiocg_destroy(struct cgroup *cgroup) 1521static void blkiocg_destroy(struct cgroup *cgroup)
1527{ 1522{
1528 struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgroup); 1523 struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgroup);
@@ -1642,11 +1637,11 @@ struct cgroup_subsys blkio_subsys = {
1642 .can_attach = blkiocg_can_attach, 1637 .can_attach = blkiocg_can_attach,
1643 .attach = blkiocg_attach, 1638 .attach = blkiocg_attach,
1644 .destroy = blkiocg_destroy, 1639 .destroy = blkiocg_destroy,
1645 .populate = blkiocg_populate,
1646#ifdef CONFIG_BLK_CGROUP 1640#ifdef CONFIG_BLK_CGROUP
1647 /* note: blkio_subsys_id is otherwise defined in blk-cgroup.h */ 1641 /* note: blkio_subsys_id is otherwise defined in blk-cgroup.h */
1648 .subsys_id = blkio_subsys_id, 1642 .subsys_id = blkio_subsys_id,
1649#endif 1643#endif
1644 .base_cftypes = blkio_files,
1650 .use_id = 1, 1645 .use_id = 1,
1651 .module = THIS_MODULE, 1646 .module = THIS_MODULE,
1652}; 1647};
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 66c1e3b5c0f2..835ae29e4ea2 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -5349,19 +5349,15 @@ static struct cftype debug_files[] = {
5349 .name = "releasable", 5349 .name = "releasable",
5350 .read_u64 = releasable_read, 5350 .read_u64 = releasable_read,
5351 }, 5351 },
5352};
5353 5352
5354static int debug_populate(struct cgroup_subsys *ss, struct cgroup *cont) 5353 { } /* terminate */
5355{ 5354};
5356 return cgroup_add_files(cont, ss, debug_files,
5357 ARRAY_SIZE(debug_files));
5358}
5359 5355
5360struct cgroup_subsys debug_subsys = { 5356struct cgroup_subsys debug_subsys = {
5361 .name = "debug", 5357 .name = "debug",
5362 .create = debug_create, 5358 .create = debug_create,
5363 .destroy = debug_destroy, 5359 .destroy = debug_destroy,
5364 .populate = debug_populate,
5365 .subsys_id = debug_subsys_id, 5360 .subsys_id = debug_subsys_id,
5361 .base_cftypes = debug_files,
5366}; 5362};
5367#endif /* CONFIG_CGROUP_DEBUG */ 5363#endif /* CONFIG_CGROUP_DEBUG */
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c
index f86e93920b62..3649fc6b3eaa 100644
--- a/kernel/cgroup_freezer.c
+++ b/kernel/cgroup_freezer.c
@@ -358,24 +358,19 @@ static int freezer_write(struct cgroup *cgroup,
358static struct cftype files[] = { 358static struct cftype files[] = {
359 { 359 {
360 .name = "state", 360 .name = "state",
361 .flags = CFTYPE_NOT_ON_ROOT,
361 .read_seq_string = freezer_read, 362 .read_seq_string = freezer_read,
362 .write_string = freezer_write, 363 .write_string = freezer_write,
363 }, 364 },
365 { } /* terminate */
364}; 366};
365 367
366static int freezer_populate(struct cgroup_subsys *ss, struct cgroup *cgroup)
367{
368 if (!cgroup->parent)
369 return 0;
370 return cgroup_add_files(cgroup, ss, files, ARRAY_SIZE(files));
371}
372
373struct cgroup_subsys freezer_subsys = { 368struct cgroup_subsys freezer_subsys = {
374 .name = "freezer", 369 .name = "freezer",
375 .create = freezer_create, 370 .create = freezer_create,
376 .destroy = freezer_destroy, 371 .destroy = freezer_destroy,
377 .populate = freezer_populate,
378 .subsys_id = freezer_subsys_id, 372 .subsys_id = freezer_subsys_id,
379 .can_attach = freezer_can_attach, 373 .can_attach = freezer_can_attach,
380 .fork = freezer_fork, 374 .fork = freezer_fork,
375 .base_cftypes = files,
381}; 376};
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index b96ad75b7e64..2382683617a3 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1765,28 +1765,17 @@ static struct cftype files[] = {
1765 .write_u64 = cpuset_write_u64, 1765 .write_u64 = cpuset_write_u64,
1766 .private = FILE_SPREAD_SLAB, 1766 .private = FILE_SPREAD_SLAB,
1767 }, 1767 },
1768};
1769
1770static struct cftype cft_memory_pressure_enabled = {
1771 .name = "memory_pressure_enabled",
1772 .read_u64 = cpuset_read_u64,
1773 .write_u64 = cpuset_write_u64,
1774 .private = FILE_MEMORY_PRESSURE_ENABLED,
1775};
1776 1768
1777static int cpuset_populate(struct cgroup_subsys *ss, struct cgroup *cont) 1769 {
1778{ 1770 .name = "memory_pressure_enabled",
1779 int err; 1771 .flags = CFTYPE_ONLY_ON_ROOT,
1772 .read_u64 = cpuset_read_u64,
1773 .write_u64 = cpuset_write_u64,
1774 .private = FILE_MEMORY_PRESSURE_ENABLED,
1775 },
1780 1776
1781 err = cgroup_add_files(cont, ss, files, ARRAY_SIZE(files)); 1777 { } /* terminate */
1782 if (err) 1778};
1783 return err;
1784 /* memory_pressure_enabled is in root cpuset only */
1785 if (!cont->parent)
1786 err = cgroup_add_file(cont, ss,
1787 &cft_memory_pressure_enabled);
1788 return err;
1789}
1790 1779
1791/* 1780/*
1792 * post_clone() is called during cgroup_create() when the 1781 * post_clone() is called during cgroup_create() when the
@@ -1887,9 +1876,9 @@ struct cgroup_subsys cpuset_subsys = {
1887 .destroy = cpuset_destroy, 1876 .destroy = cpuset_destroy,
1888 .can_attach = cpuset_can_attach, 1877 .can_attach = cpuset_can_attach,
1889 .attach = cpuset_attach, 1878 .attach = cpuset_attach,
1890 .populate = cpuset_populate,
1891 .post_clone = cpuset_post_clone, 1879 .post_clone = cpuset_post_clone,
1892 .subsys_id = cpuset_subsys_id, 1880 .subsys_id = cpuset_subsys_id,
1881 .base_cftypes = files,
1893 .early_init = 1, 1882 .early_init = 1,
1894}; 1883};
1895 1884
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 4603b9d8f30a..afc6d7e71557 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7970,13 +7970,9 @@ static struct cftype cpu_files[] = {
7970 .write_u64 = cpu_rt_period_write_uint, 7970 .write_u64 = cpu_rt_period_write_uint,
7971 }, 7971 },
7972#endif 7972#endif
7973 { } /* terminate */
7973}; 7974};
7974 7975
7975static int cpu_cgroup_populate(struct cgroup_subsys *ss, struct cgroup *cont)
7976{
7977 return cgroup_add_files(cont, ss, cpu_files, ARRAY_SIZE(cpu_files));
7978}
7979
7980struct cgroup_subsys cpu_cgroup_subsys = { 7976struct cgroup_subsys cpu_cgroup_subsys = {
7981 .name = "cpu", 7977 .name = "cpu",
7982 .create = cpu_cgroup_create, 7978 .create = cpu_cgroup_create,
@@ -7984,8 +7980,8 @@ struct cgroup_subsys cpu_cgroup_subsys = {
7984 .can_attach = cpu_cgroup_can_attach, 7980 .can_attach = cpu_cgroup_can_attach,
7985 .attach = cpu_cgroup_attach, 7981 .attach = cpu_cgroup_attach,
7986 .exit = cpu_cgroup_exit, 7982 .exit = cpu_cgroup_exit,
7987 .populate = cpu_cgroup_populate,
7988 .subsys_id = cpu_cgroup_subsys_id, 7983 .subsys_id = cpu_cgroup_subsys_id,
7984 .base_cftypes = cpu_files,
7989 .early_init = 1, 7985 .early_init = 1,
7990}; 7986};
7991 7987
@@ -8170,13 +8166,9 @@ static struct cftype files[] = {
8170 .name = "stat", 8166 .name = "stat",
8171 .read_map = cpuacct_stats_show, 8167 .read_map = cpuacct_stats_show,
8172 }, 8168 },
8169 { } /* terminate */
8173}; 8170};
8174 8171
8175static int cpuacct_populate(struct cgroup_subsys *ss, struct cgroup *cgrp)
8176{
8177 return cgroup_add_files(cgrp, ss, files, ARRAY_SIZE(files));
8178}
8179
8180/* 8172/*
8181 * charge this task's execution time to its accounting group. 8173 * charge this task's execution time to its accounting group.
8182 * 8174 *
@@ -8208,7 +8200,7 @@ struct cgroup_subsys cpuacct_subsys = {
8208 .name = "cpuacct", 8200 .name = "cpuacct",
8209 .create = cpuacct_create, 8201 .create = cpuacct_create,
8210 .destroy = cpuacct_destroy, 8202 .destroy = cpuacct_destroy,
8211 .populate = cpuacct_populate,
8212 .subsys_id = cpuacct_subsys_id, 8203 .subsys_id = cpuacct_subsys_id,
8204 .base_cftypes = files,
8213}; 8205};
8214#endif /* CONFIG_CGROUP_CPUACCT */ 8206#endif /* CONFIG_CGROUP_CPUACCT */
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c
index dbfd4e7f8dc4..b2a59866699f 100644
--- a/net/core/netprio_cgroup.c
+++ b/net/core/netprio_cgroup.c
@@ -242,21 +242,17 @@ static struct cftype ss_files[] = {
242 .read_map = read_priomap, 242 .read_map = read_priomap,
243 .write_string = write_priomap, 243 .write_string = write_priomap,
244 }, 244 },
245 { } /* terminate */
245}; 246};
246 247
247static int cgrp_populate(struct cgroup_subsys *ss, struct cgroup *cgrp)
248{
249 return cgroup_add_files(cgrp, ss, ss_files, ARRAY_SIZE(ss_files));
250}
251
252struct cgroup_subsys net_prio_subsys = { 248struct cgroup_subsys net_prio_subsys = {
253 .name = "net_prio", 249 .name = "net_prio",
254 .create = cgrp_create, 250 .create = cgrp_create,
255 .destroy = cgrp_destroy, 251 .destroy = cgrp_destroy,
256 .populate = cgrp_populate,
257#ifdef CONFIG_NETPRIO_CGROUP 252#ifdef CONFIG_NETPRIO_CGROUP
258 .subsys_id = net_prio_subsys_id, 253 .subsys_id = net_prio_subsys_id,
259#endif 254#endif
255 .base_cftypes = ss_files,
260 .module = THIS_MODULE 256 .module = THIS_MODULE
261}; 257};
262 258
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index 024df8a32275..7743ea8d1d38 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -70,21 +70,17 @@ static struct cftype ss_files[] = {
70 .read_u64 = read_classid, 70 .read_u64 = read_classid,
71 .write_u64 = write_classid, 71 .write_u64 = write_classid,
72 }, 72 },
73 { } /* terminate */
73}; 74};
74 75
75static int cgrp_populate(struct cgroup_subsys *ss, struct cgroup *cgrp)
76{
77 return cgroup_add_files(cgrp, ss, ss_files, ARRAY_SIZE(ss_files));
78}
79
80struct cgroup_subsys net_cls_subsys = { 76struct cgroup_subsys net_cls_subsys = {
81 .name = "net_cls", 77 .name = "net_cls",
82 .create = cgrp_create, 78 .create = cgrp_create,
83 .destroy = cgrp_destroy, 79 .destroy = cgrp_destroy,
84 .populate = cgrp_populate,
85#ifdef CONFIG_NET_CLS_CGROUP 80#ifdef CONFIG_NET_CLS_CGROUP
86 .subsys_id = net_cls_subsys_id, 81 .subsys_id = net_cls_subsys_id,
87#endif 82#endif
83 .base_cftypes = ss_files,
88 .module = THIS_MODULE, 84 .module = THIS_MODULE,
89}; 85};
90 86
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index c43a3323feea..442204cc22d9 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -447,22 +447,16 @@ static struct cftype dev_cgroup_files[] = {
447 .read_seq_string = devcgroup_seq_read, 447 .read_seq_string = devcgroup_seq_read,
448 .private = DEVCG_LIST, 448 .private = DEVCG_LIST,
449 }, 449 },
450 { } /* terminate */
450}; 451};
451 452
452static int devcgroup_populate(struct cgroup_subsys *ss,
453 struct cgroup *cgroup)
454{
455 return cgroup_add_files(cgroup, ss, dev_cgroup_files,
456 ARRAY_SIZE(dev_cgroup_files));
457}
458
459struct cgroup_subsys devices_subsys = { 453struct cgroup_subsys devices_subsys = {
460 .name = "devices", 454 .name = "devices",
461 .can_attach = devcgroup_can_attach, 455 .can_attach = devcgroup_can_attach,
462 .create = devcgroup_create, 456 .create = devcgroup_create,
463 .destroy = devcgroup_destroy, 457 .destroy = devcgroup_destroy,
464 .populate = devcgroup_populate,
465 .subsys_id = devices_subsys_id, 458 .subsys_id = devices_subsys_id,
459 .base_cftypes = dev_cgroup_files,
466}; 460};
467 461
468int __devcgroup_inode_permission(struct inode *inode, int mask) 462int __devcgroup_inode_permission(struct inode *inode, int mask)