Commit 614a6d4341b3760ca98a1c2c09141b71db5d1e90
Merge branch 'for-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup changes from Tejun Heo: "Nothing too interesting. A minor bug fix and some cleanups." * 'for-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: cgroup: Update remount documentation cgroup: cgroup_rm_files() was calling simple_unlink() with the wrong inode cgroup: Remove populate() documentation cgroup: remove hierarchy_mutex
Showing 3 changed files Side-by-side Diff
Documentation/cgroups/cgroups.txt
... | ... | @@ -370,16 +370,13 @@ |
370 | 370 | subsystems, type: |
371 | 371 | # mount -t cgroup -o cpuset,memory hier1 /sys/fs/cgroup/rg1 |
372 | 372 | |
373 | -To change the set of subsystems bound to a mounted hierarchy, just | |
374 | -remount with different options: | |
375 | -# mount -o remount,cpuset,blkio hier1 /sys/fs/cgroup/rg1 | |
373 | +While remounting cgroups is currently supported, it is not recommend | |
374 | +to use it. Remounting allows changing bound subsystems and | |
375 | +release_agent. Rebinding is hardly useful as it only works when the | |
376 | +hierarchy is empty and release_agent itself should be replaced with | |
377 | +conventional fsnotify. The support for remounting will be removed in | |
378 | +the future. | |
376 | 379 | |
377 | -Now memory is removed from the hierarchy and blkio is added. | |
378 | - | |
379 | -Note this will add blkio to the hierarchy but won't remove memory or | |
380 | -cpuset, because the new options are appended to the old ones: | |
381 | -# mount -o remount,blkio /sys/fs/cgroup/rg1 | |
382 | - | |
383 | 380 | To Specify a hierarchy's release_agent: |
384 | 381 | # mount -t cgroup -o cpuset,release_agent="/sbin/cpuset_release_agent" \ |
385 | 382 | xxx /sys/fs/cgroup/rg1 |
... | ... | @@ -637,16 +634,6 @@ |
637 | 634 | |
638 | 635 | Called during task exit. |
639 | 636 | |
640 | -int populate(struct cgroup *cgrp) | |
641 | -(cgroup_mutex held by caller) | |
642 | - | |
643 | -Called after creation of a cgroup to allow a subsystem to populate | |
644 | -the cgroup directory with file entries. The subsystem should make | |
645 | -calls to cgroup_add_file() with objects of type cftype (see | |
646 | -include/linux/cgroup.h for details). Note that although this | |
647 | -method can return an error code, the error code is currently not | |
648 | -always handled well. | |
649 | - | |
650 | 637 | void post_clone(struct cgroup *cgrp) |
651 | 638 | (cgroup_mutex held by caller) |
652 | 639 | |
... | ... | @@ -656,7 +643,7 @@ |
656 | 643 | up. |
657 | 644 | |
658 | 645 | void bind(struct cgroup *root) |
659 | -(cgroup_mutex and ss->hierarchy_mutex held by caller) | |
646 | +(cgroup_mutex held by caller) | |
660 | 647 | |
661 | 648 | Called when a cgroup subsystem is rebound to a different hierarchy |
662 | 649 | and root cgroup. Currently this will only involve movement between |
include/linux/cgroup.h
... | ... | @@ -500,21 +500,8 @@ |
500 | 500 | const char *name; |
501 | 501 | |
502 | 502 | /* |
503 | - * Protects sibling/children links of cgroups in this | |
504 | - * hierarchy, plus protects which hierarchy (or none) the | |
505 | - * subsystem is a part of (i.e. root/sibling). To avoid | |
506 | - * potential deadlocks, the following operations should not be | |
507 | - * undertaken while holding any hierarchy_mutex: | |
508 | - * | |
509 | - * - allocating memory | |
510 | - * - initiating hotplug events | |
511 | - */ | |
512 | - struct mutex hierarchy_mutex; | |
513 | - struct lock_class_key subsys_key; | |
514 | - | |
515 | - /* | |
516 | 503 | * Link to parent, and list entry in parent's children. |
517 | - * Protected by this->hierarchy_mutex and cgroup_lock() | |
504 | + * Protected by cgroup_lock() | |
518 | 505 | */ |
519 | 506 | struct cgroupfs_root *root; |
520 | 507 | struct list_head sibling; |
... | ... | @@ -602,7 +589,7 @@ |
602 | 589 | * the lifetime of cgroup_subsys_state is subsys's matter. |
603 | 590 | * |
604 | 591 | * Looking up and scanning function should be called under rcu_read_lock(). |
605 | - * Taking cgroup_mutex()/hierarchy_mutex() is not necessary for following calls. | |
592 | + * Taking cgroup_mutex is not necessary for following calls. | |
606 | 593 | * But the css returned by this routine can be "not populated yet" or "being |
607 | 594 | * destroyed". The caller should check css and cgroup's status. |
608 | 595 | */ |
kernel/cgroup.c
... | ... | @@ -954,7 +954,7 @@ |
954 | 954 | |
955 | 955 | dget(d); |
956 | 956 | d_delete(d); |
957 | - simple_unlink(d->d_inode, d); | |
957 | + simple_unlink(cgrp->dentry->d_inode, d); | |
958 | 958 | list_del_init(&cfe->node); |
959 | 959 | dput(d); |
960 | 960 | |
961 | 961 | |
962 | 962 | |
963 | 963 | |
... | ... | @@ -1068,28 +1068,24 @@ |
1068 | 1068 | BUG_ON(cgrp->subsys[i]); |
1069 | 1069 | BUG_ON(!dummytop->subsys[i]); |
1070 | 1070 | BUG_ON(dummytop->subsys[i]->cgroup != dummytop); |
1071 | - mutex_lock(&ss->hierarchy_mutex); | |
1072 | 1071 | cgrp->subsys[i] = dummytop->subsys[i]; |
1073 | 1072 | cgrp->subsys[i]->cgroup = cgrp; |
1074 | 1073 | list_move(&ss->sibling, &root->subsys_list); |
1075 | 1074 | ss->root = root; |
1076 | 1075 | if (ss->bind) |
1077 | 1076 | ss->bind(cgrp); |
1078 | - mutex_unlock(&ss->hierarchy_mutex); | |
1079 | 1077 | /* refcount was already taken, and we're keeping it */ |
1080 | 1078 | } else if (bit & removed_bits) { |
1081 | 1079 | /* We're removing this subsystem */ |
1082 | 1080 | BUG_ON(ss == NULL); |
1083 | 1081 | BUG_ON(cgrp->subsys[i] != dummytop->subsys[i]); |
1084 | 1082 | BUG_ON(cgrp->subsys[i]->cgroup != cgrp); |
1085 | - mutex_lock(&ss->hierarchy_mutex); | |
1086 | 1083 | if (ss->bind) |
1087 | 1084 | ss->bind(dummytop); |
1088 | 1085 | dummytop->subsys[i]->cgroup = dummytop; |
1089 | 1086 | cgrp->subsys[i] = NULL; |
1090 | 1087 | subsys[i]->root = &rootnode; |
1091 | 1088 | list_move(&ss->sibling, &rootnode.subsys_list); |
1092 | - mutex_unlock(&ss->hierarchy_mutex); | |
1093 | 1089 | /* subsystem is now free - drop reference on module */ |
1094 | 1090 | module_put(ss->module); |
1095 | 1091 | } else if (bit & final_bits) { |
... | ... | @@ -3915,37 +3911,6 @@ |
3915 | 3911 | set_bit(CSS_CLEAR_CSS_REFS, &css->flags); |
3916 | 3912 | } |
3917 | 3913 | |
3918 | -static void cgroup_lock_hierarchy(struct cgroupfs_root *root) | |
3919 | -{ | |
3920 | - /* We need to take each hierarchy_mutex in a consistent order */ | |
3921 | - int i; | |
3922 | - | |
3923 | - /* | |
3924 | - * No worry about a race with rebind_subsystems that might mess up the | |
3925 | - * locking order, since both parties are under cgroup_mutex. | |
3926 | - */ | |
3927 | - for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { | |
3928 | - struct cgroup_subsys *ss = subsys[i]; | |
3929 | - if (ss == NULL) | |
3930 | - continue; | |
3931 | - if (ss->root == root) | |
3932 | - mutex_lock(&ss->hierarchy_mutex); | |
3933 | - } | |
3934 | -} | |
3935 | - | |
3936 | -static void cgroup_unlock_hierarchy(struct cgroupfs_root *root) | |
3937 | -{ | |
3938 | - int i; | |
3939 | - | |
3940 | - for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { | |
3941 | - struct cgroup_subsys *ss = subsys[i]; | |
3942 | - if (ss == NULL) | |
3943 | - continue; | |
3944 | - if (ss->root == root) | |
3945 | - mutex_unlock(&ss->hierarchy_mutex); | |
3946 | - } | |
3947 | -} | |
3948 | - | |
3949 | 3914 | /* |
3950 | 3915 | * cgroup_create - create a cgroup |
3951 | 3916 | * @parent: cgroup that will be parent of the new cgroup |
3952 | 3917 | |
... | ... | @@ -4006,9 +3971,7 @@ |
4006 | 3971 | ss->post_clone(cgrp); |
4007 | 3972 | } |
4008 | 3973 | |
4009 | - cgroup_lock_hierarchy(root); | |
4010 | 3974 | list_add(&cgrp->sibling, &cgrp->parent->children); |
4011 | - cgroup_unlock_hierarchy(root); | |
4012 | 3975 | root->number_of_cgroups++; |
4013 | 3976 | |
4014 | 3977 | err = cgroup_create_dir(cgrp, dentry, mode); |
4015 | 3978 | |
... | ... | @@ -4035,9 +3998,7 @@ |
4035 | 3998 | |
4036 | 3999 | err_remove: |
4037 | 4000 | |
4038 | - cgroup_lock_hierarchy(root); | |
4039 | 4001 | list_del(&cgrp->sibling); |
4040 | - cgroup_unlock_hierarchy(root); | |
4041 | 4002 | root->number_of_cgroups--; |
4042 | 4003 | |
4043 | 4004 | err_destroy: |
4044 | 4005 | |
... | ... | @@ -4245,10 +4206,8 @@ |
4245 | 4206 | list_del_init(&cgrp->release_list); |
4246 | 4207 | raw_spin_unlock(&release_list_lock); |
4247 | 4208 | |
4248 | - cgroup_lock_hierarchy(cgrp->root); | |
4249 | 4209 | /* delete this cgroup from parent->children */ |
4250 | 4210 | list_del_init(&cgrp->sibling); |
4251 | - cgroup_unlock_hierarchy(cgrp->root); | |
4252 | 4211 | |
4253 | 4212 | list_del_init(&cgrp->allcg_node); |
4254 | 4213 | |
... | ... | @@ -4322,8 +4281,6 @@ |
4322 | 4281 | * need to invoke fork callbacks here. */ |
4323 | 4282 | BUG_ON(!list_empty(&init_task.tasks)); |
4324 | 4283 | |
4325 | - mutex_init(&ss->hierarchy_mutex); | |
4326 | - lockdep_set_class(&ss->hierarchy_mutex, &ss->subsys_key); | |
4327 | 4284 | ss->active = 1; |
4328 | 4285 | |
4329 | 4286 | /* this function shouldn't be used with modular subsystems, since they |
... | ... | @@ -4450,8 +4407,6 @@ |
4450 | 4407 | } |
4451 | 4408 | write_unlock(&css_set_lock); |
4452 | 4409 | |
4453 | - mutex_init(&ss->hierarchy_mutex); | |
4454 | - lockdep_set_class(&ss->hierarchy_mutex, &ss->subsys_key); | |
4455 | 4410 | ss->active = 1; |
4456 | 4411 | |
4457 | 4412 | /* success! */ |