diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-22 20:40:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-22 20:40:19 -0400 |
commit | 88d6ae8dc33af12fe1c7941b1fae2767374046fd (patch) | |
tree | 8f17415c0722b0a4d7511ac170cfb4e3802e1ad2 /block | |
parent | f5c101892fbd3d2f6d2729bc7eb7b3f6c31dbddd (diff) | |
parent | 0d4dde1ac9a5af74ac76c6ab90557d1ae7b8f5d8 (diff) |
Merge branch 'for-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup updates from Tejun Heo:
"cgroup file type addition / removal is updated so that file types are
added and removed instead of individual files so that dynamic file
type addition / removal can be implemented by cgroup and used by
controllers. blkio controller changes which will come through block
tree are dependent on this. Other changes include res_counter cleanup
and disallowing kthread / PF_THREAD_BOUND threads to be attached to
non-root cgroups.
There's a reported bug with the file type addition / removal handling
which can lead to oops on cgroup umount. The issue is being looked
into. It shouldn't cause problems for most setups and isn't a
security concern."
Fix up trivial conflict in Documentation/feature-removal-schedule.txt
* 'for-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: (21 commits)
res_counter: Account max_usage when calling res_counter_charge_nofail()
res_counter: Merge res_counter_charge and res_counter_charge_nofail
cgroups: disallow attaching kthreadd or PF_THREAD_BOUND threads
cgroup: remove cgroup_subsys->populate()
cgroup: get rid of populate for memcg
cgroup: pass struct mem_cgroup instead of struct cgroup to socket memcg
cgroup: make css->refcnt clearing on cgroup removal optional
cgroup: use negative bias on css->refcnt to block css_tryget()
cgroup: implement cgroup_rm_cftypes()
cgroup: introduce struct cfent
cgroup: relocate __d_cgrp() and __d_cft()
cgroup: remove cgroup_add_file[s]()
cgroup: convert memcg controller to the new cftype interface
memcg: always create memsw files if CONFIG_CGROUP_MEM_RES_CTLR_SWAP
cgroup: convert all non-memcg controllers to the new cftype interface
cgroup: relocate cftype and cgroup_subsys definitions in controllers
cgroup: merge cft_release_agent cftype array into the base files array
cgroup: implement cgroup_add_cftypes() and friends
cgroup: build list of all cgroups under a given cgroupfs_root
cgroup: move cgroup_clear_directory() call out of cgroup_populate_dir()
...
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-cgroup.c | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index ea84a23d5e68..126c341955de 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -28,34 +28,12 @@ static LIST_HEAD(blkio_list); | |||
28 | struct blkio_cgroup blkio_root_cgroup = { .weight = 2*BLKIO_WEIGHT_DEFAULT }; | 28 | struct blkio_cgroup blkio_root_cgroup = { .weight = 2*BLKIO_WEIGHT_DEFAULT }; |
29 | EXPORT_SYMBOL_GPL(blkio_root_cgroup); | 29 | EXPORT_SYMBOL_GPL(blkio_root_cgroup); |
30 | 30 | ||
31 | static struct cgroup_subsys_state *blkiocg_create(struct cgroup *); | ||
32 | static int blkiocg_can_attach(struct cgroup *, struct cgroup_taskset *); | ||
33 | static void blkiocg_attach(struct cgroup *, struct cgroup_taskset *); | ||
34 | static void blkiocg_destroy(struct cgroup *); | ||
35 | static int blkiocg_populate(struct cgroup_subsys *, struct cgroup *); | ||
36 | |||
37 | /* for encoding cft->private value on file */ | 31 | /* for encoding cft->private value on file */ |
38 | #define BLKIOFILE_PRIVATE(x, val) (((x) << 16) | (val)) | 32 | #define BLKIOFILE_PRIVATE(x, val) (((x) << 16) | (val)) |
39 | /* What policy owns the file, proportional or throttle */ | 33 | /* What policy owns the file, proportional or throttle */ |
40 | #define BLKIOFILE_POLICY(val) (((val) >> 16) & 0xffff) | 34 | #define BLKIOFILE_POLICY(val) (((val) >> 16) & 0xffff) |
41 | #define BLKIOFILE_ATTR(val) ((val) & 0xffff) | 35 | #define BLKIOFILE_ATTR(val) ((val) & 0xffff) |
42 | 36 | ||
43 | struct cgroup_subsys blkio_subsys = { | ||
44 | .name = "blkio", | ||
45 | .create = blkiocg_create, | ||
46 | .can_attach = blkiocg_can_attach, | ||
47 | .attach = blkiocg_attach, | ||
48 | .destroy = blkiocg_destroy, | ||
49 | .populate = blkiocg_populate, | ||
50 | #ifdef CONFIG_BLK_CGROUP | ||
51 | /* note: blkio_subsys_id is otherwise defined in blk-cgroup.h */ | ||
52 | .subsys_id = blkio_subsys_id, | ||
53 | #endif | ||
54 | .use_id = 1, | ||
55 | .module = THIS_MODULE, | ||
56 | }; | ||
57 | EXPORT_SYMBOL_GPL(blkio_subsys); | ||
58 | |||
59 | static inline void blkio_policy_insert_node(struct blkio_cgroup *blkcg, | 37 | static inline void blkio_policy_insert_node(struct blkio_cgroup *blkcg, |
60 | struct blkio_policy_node *pn) | 38 | struct blkio_policy_node *pn) |
61 | { | 39 | { |
@@ -1537,14 +1515,9 @@ struct cftype blkio_files[] = { | |||
1537 | .read_map = blkiocg_file_read_map, | 1515 | .read_map = blkiocg_file_read_map, |
1538 | }, | 1516 | }, |
1539 | #endif | 1517 | #endif |
1518 | { } /* terminate */ | ||
1540 | }; | 1519 | }; |
1541 | 1520 | ||
1542 | static int blkiocg_populate(struct cgroup_subsys *subsys, struct cgroup *cgroup) | ||
1543 | { | ||
1544 | return cgroup_add_files(cgroup, subsys, blkio_files, | ||
1545 | ARRAY_SIZE(blkio_files)); | ||
1546 | } | ||
1547 | |||
1548 | static void blkiocg_destroy(struct cgroup *cgroup) | 1521 | static void blkiocg_destroy(struct cgroup *cgroup) |
1549 | { | 1522 | { |
1550 | struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgroup); | 1523 | struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgroup); |
@@ -1658,6 +1631,22 @@ static void blkiocg_attach(struct cgroup *cgrp, struct cgroup_taskset *tset) | |||
1658 | } | 1631 | } |
1659 | } | 1632 | } |
1660 | 1633 | ||
1634 | struct cgroup_subsys blkio_subsys = { | ||
1635 | .name = "blkio", | ||
1636 | .create = blkiocg_create, | ||
1637 | .can_attach = blkiocg_can_attach, | ||
1638 | .attach = blkiocg_attach, | ||
1639 | .destroy = blkiocg_destroy, | ||
1640 | #ifdef CONFIG_BLK_CGROUP | ||
1641 | /* note: blkio_subsys_id is otherwise defined in blk-cgroup.h */ | ||
1642 | .subsys_id = blkio_subsys_id, | ||
1643 | #endif | ||
1644 | .base_cftypes = blkio_files, | ||
1645 | .use_id = 1, | ||
1646 | .module = THIS_MODULE, | ||
1647 | }; | ||
1648 | EXPORT_SYMBOL_GPL(blkio_subsys); | ||
1649 | |||
1661 | void blkio_policy_register(struct blkio_policy_type *blkiop) | 1650 | void blkio_policy_register(struct blkio_policy_type *blkiop) |
1662 | { | 1651 | { |
1663 | spin_lock(&blkio_list_lock); | 1652 | spin_lock(&blkio_list_lock); |