aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPaul Menage <menage@google.com>2007-10-19 02:40:44 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 14:53:43 -0400
commitbd89aabc6761de1c35b154fe6f914a445d301510 (patch)
tree4564755be493b144d9a78766eae3de87326e23e4 /kernel
parent69cccb887a35f3761b7ea62cdd2bee602868c735 (diff)
Control groups: Replace "cont" with "cgrp" and other misc renaming
Replace "cont" with "cgrp" and other misc renaming This patch finishes some of the names that got missed in the great "task containers" -> "control groups" rename. Primarily it renames the local variable "cont" to "cgrp" in a number of places, and renames the CONT_* enum members to CGRP_*. This patch is not intended to have any effect on the generated code; the output of "objdump -d kernel/cgroup.o" is unchanged. Signed-off-by: Paul Menage <menage@google.com> Acked-by: Paul Jackson <pj@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cgroup.c494
1 files changed, 247 insertions, 247 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index c2f12a49dff2..5987dccdb2a0 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -124,18 +124,18 @@ static int need_forkexit_callback;
124/* bits in struct cgroup flags field */ 124/* bits in struct cgroup flags field */
125enum { 125enum {
126 /* Control Group is dead */ 126 /* Control Group is dead */
127 CONT_REMOVED, 127 CGRP_REMOVED,
128 /* Control Group has previously had a child cgroup or a task, 128 /* Control Group has previously had a child cgroup or a task,
129 * but no longer (only if CONT_NOTIFY_ON_RELEASE is set) */ 129 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) */
130 CONT_RELEASABLE, 130 CGRP_RELEASABLE,
131 /* Control Group requires release notifications to userspace */ 131 /* Control Group requires release notifications to userspace */
132 CONT_NOTIFY_ON_RELEASE, 132 CGRP_NOTIFY_ON_RELEASE,
133}; 133};
134 134
135/* convenient tests for these bits */ 135/* convenient tests for these bits */
136inline int cgroup_is_removed(const struct cgroup *cont) 136inline int cgroup_is_removed(const struct cgroup *cgrp)
137{ 137{
138 return test_bit(CONT_REMOVED, &cont->flags); 138 return test_bit(CGRP_REMOVED, &cgrp->flags);
139} 139}
140 140
141/* bits in struct cgroupfs_root flags field */ 141/* bits in struct cgroupfs_root flags field */
@@ -143,17 +143,17 @@ enum {
143 ROOT_NOPREFIX, /* mounted subsystems have no named prefix */ 143 ROOT_NOPREFIX, /* mounted subsystems have no named prefix */
144}; 144};
145 145
146inline int cgroup_is_releasable(const struct cgroup *cont) 146inline int cgroup_is_releasable(const struct cgroup *cgrp)
147{ 147{
148 const int bits = 148 const int bits =
149 (1 << CONT_RELEASABLE) | 149 (1 << CGRP_RELEASABLE) |
150 (1 << CONT_NOTIFY_ON_RELEASE); 150 (1 << CGRP_NOTIFY_ON_RELEASE);
151 return (cont->flags & bits) == bits; 151 return (cgrp->flags & bits) == bits;
152} 152}
153 153
154inline int notify_on_release(const struct cgroup *cont) 154inline int notify_on_release(const struct cgroup *cgrp)
155{ 155{
156 return test_bit(CONT_NOTIFY_ON_RELEASE, &cont->flags); 156 return test_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
157} 157}
158 158
159/* 159/*
@@ -173,7 +173,7 @@ static LIST_HEAD(release_list);
173static DEFINE_SPINLOCK(release_list_lock); 173static DEFINE_SPINLOCK(release_list_lock);
174static void cgroup_release_agent(struct work_struct *work); 174static void cgroup_release_agent(struct work_struct *work);
175static DECLARE_WORK(release_agent_work, cgroup_release_agent); 175static DECLARE_WORK(release_agent_work, cgroup_release_agent);
176static void check_for_release(struct cgroup *cont); 176static void check_for_release(struct cgroup *cgrp);
177 177
178/* Link structure for associating css_set objects with cgroups */ 178/* Link structure for associating css_set objects with cgroups */
179struct cg_cgroup_link { 179struct cg_cgroup_link {
@@ -181,7 +181,7 @@ struct cg_cgroup_link {
181 * List running through cg_cgroup_links associated with a 181 * List running through cg_cgroup_links associated with a
182 * cgroup, anchored on cgroup->css_sets 182 * cgroup, anchored on cgroup->css_sets
183 */ 183 */
184 struct list_head cont_link_list; 184 struct list_head cgrp_link_list;
185 /* 185 /*
186 * List running through cg_cgroup_links pointing at a 186 * List running through cg_cgroup_links pointing at a
187 * single css_set object, anchored on css_set->cg_links 187 * single css_set object, anchored on css_set->cg_links
@@ -239,7 +239,7 @@ static void unlink_css_set(struct css_set *cg)
239 link = list_entry(cg->cg_links.next, 239 link = list_entry(cg->cg_links.next,
240 struct cg_cgroup_link, cg_link_list); 240 struct cg_cgroup_link, cg_link_list);
241 list_del(&link->cg_link_list); 241 list_del(&link->cg_link_list);
242 list_del(&link->cont_link_list); 242 list_del(&link->cgrp_link_list);
243 kfree(link); 243 kfree(link);
244 } 244 }
245 write_unlock(&css_set_lock); 245 write_unlock(&css_set_lock);
@@ -254,12 +254,12 @@ static void __release_css_set(struct kref *k, int taskexit)
254 254
255 rcu_read_lock(); 255 rcu_read_lock();
256 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { 256 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
257 struct cgroup *cont = cg->subsys[i]->cgroup; 257 struct cgroup *cgrp = cg->subsys[i]->cgroup;
258 if (atomic_dec_and_test(&cont->count) && 258 if (atomic_dec_and_test(&cgrp->count) &&
259 notify_on_release(cont)) { 259 notify_on_release(cgrp)) {
260 if (taskexit) 260 if (taskexit)
261 set_bit(CONT_RELEASABLE, &cont->flags); 261 set_bit(CGRP_RELEASABLE, &cgrp->flags);
262 check_for_release(cont); 262 check_for_release(cgrp);
263 } 263 }
264 } 264 }
265 rcu_read_unlock(); 265 rcu_read_unlock();
@@ -304,7 +304,7 @@ static inline void put_css_set_taskexit(struct css_set *cg)
304 * oldcg: the cgroup group that we're using before the cgroup 304 * oldcg: the cgroup group that we're using before the cgroup
305 * transition 305 * transition
306 * 306 *
307 * cont: the cgroup that we're moving into 307 * cgrp: the cgroup that we're moving into
308 * 308 *
309 * template: location in which to build the desired set of subsystem 309 * template: location in which to build the desired set of subsystem
310 * state objects for the new cgroup group 310 * state objects for the new cgroup group
@@ -312,11 +312,11 @@ static inline void put_css_set_taskexit(struct css_set *cg)
312 312
313static struct css_set *find_existing_css_set( 313static struct css_set *find_existing_css_set(
314 struct css_set *oldcg, 314 struct css_set *oldcg,
315 struct cgroup *cont, 315 struct cgroup *cgrp,
316 struct cgroup_subsys_state *template[]) 316 struct cgroup_subsys_state *template[])
317{ 317{
318 int i; 318 int i;
319 struct cgroupfs_root *root = cont->root; 319 struct cgroupfs_root *root = cgrp->root;
320 struct list_head *l = &init_css_set.list; 320 struct list_head *l = &init_css_set.list;
321 321
322 /* Built the set of subsystem state objects that we want to 322 /* Built the set of subsystem state objects that we want to
@@ -326,7 +326,7 @@ static struct css_set *find_existing_css_set(
326 /* Subsystem is in this hierarchy. So we want 326 /* Subsystem is in this hierarchy. So we want
327 * the subsystem state from the new 327 * the subsystem state from the new
328 * cgroup */ 328 * cgroup */
329 template[i] = cont->subsys[i]; 329 template[i] = cgrp->subsys[i];
330 } else { 330 } else {
331 /* Subsystem is not in this hierarchy, so we 331 /* Subsystem is not in this hierarchy, so we
332 * don't want to change the subsystem state */ 332 * don't want to change the subsystem state */
@@ -353,7 +353,7 @@ static struct css_set *find_existing_css_set(
353 353
354/* 354/*
355 * allocate_cg_links() allocates "count" cg_cgroup_link structures 355 * allocate_cg_links() allocates "count" cg_cgroup_link structures
356 * and chains them on tmp through their cont_link_list fields. Returns 0 on 356 * and chains them on tmp through their cgrp_link_list fields. Returns 0 on
357 * success or a negative error 357 * success or a negative error
358 */ 358 */
359 359
@@ -368,13 +368,13 @@ static int allocate_cg_links(int count, struct list_head *tmp)
368 while (!list_empty(tmp)) { 368 while (!list_empty(tmp)) {
369 link = list_entry(tmp->next, 369 link = list_entry(tmp->next,
370 struct cg_cgroup_link, 370 struct cg_cgroup_link,
371 cont_link_list); 371 cgrp_link_list);
372 list_del(&link->cont_link_list); 372 list_del(&link->cgrp_link_list);
373 kfree(link); 373 kfree(link);
374 } 374 }
375 return -ENOMEM; 375 return -ENOMEM;
376 } 376 }
377 list_add(&link->cont_link_list, tmp); 377 list_add(&link->cgrp_link_list, tmp);
378 } 378 }
379 return 0; 379 return 0;
380} 380}
@@ -385,8 +385,8 @@ static void free_cg_links(struct list_head *tmp)
385 struct cg_cgroup_link *link; 385 struct cg_cgroup_link *link;
386 link = list_entry(tmp->next, 386 link = list_entry(tmp->next,
387 struct cg_cgroup_link, 387 struct cg_cgroup_link,
388 cont_link_list); 388 cgrp_link_list);
389 list_del(&link->cont_link_list); 389 list_del(&link->cgrp_link_list);
390 kfree(link); 390 kfree(link);
391 } 391 }
392} 392}
@@ -400,7 +400,7 @@ static void free_cg_links(struct list_head *tmp)
400 */ 400 */
401 401
402static struct css_set *find_css_set( 402static struct css_set *find_css_set(
403 struct css_set *oldcg, struct cgroup *cont) 403 struct css_set *oldcg, struct cgroup *cgrp)
404{ 404{
405 struct css_set *res; 405 struct css_set *res;
406 struct cgroup_subsys_state *template[CGROUP_SUBSYS_COUNT]; 406 struct cgroup_subsys_state *template[CGROUP_SUBSYS_COUNT];
@@ -412,7 +412,7 @@ static struct css_set *find_css_set(
412 /* First see if we already have a cgroup group that matches 412 /* First see if we already have a cgroup group that matches
413 * the desired set */ 413 * the desired set */
414 write_lock(&css_set_lock); 414 write_lock(&css_set_lock);
415 res = find_existing_css_set(oldcg, cont, template); 415 res = find_existing_css_set(oldcg, cgrp, template);
416 if (res) 416 if (res)
417 get_css_set(res); 417 get_css_set(res);
418 write_unlock(&css_set_lock); 418 write_unlock(&css_set_lock);
@@ -441,9 +441,9 @@ static struct css_set *find_css_set(
441 write_lock(&css_set_lock); 441 write_lock(&css_set_lock);
442 /* Add reference counts and links from the new css_set. */ 442 /* Add reference counts and links from the new css_set. */
443 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { 443 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
444 struct cgroup *cont = res->subsys[i]->cgroup; 444 struct cgroup *cgrp = res->subsys[i]->cgroup;
445 struct cgroup_subsys *ss = subsys[i]; 445 struct cgroup_subsys *ss = subsys[i];
446 atomic_inc(&cont->count); 446 atomic_inc(&cgrp->count);
447 /* 447 /*
448 * We want to add a link once per cgroup, so we 448 * We want to add a link once per cgroup, so we
449 * only do it for the first subsystem in each 449 * only do it for the first subsystem in each
@@ -453,9 +453,9 @@ static struct css_set *find_css_set(
453 BUG_ON(list_empty(&tmp_cg_links)); 453 BUG_ON(list_empty(&tmp_cg_links));
454 link = list_entry(tmp_cg_links.next, 454 link = list_entry(tmp_cg_links.next,
455 struct cg_cgroup_link, 455 struct cg_cgroup_link,
456 cont_link_list); 456 cgrp_link_list);
457 list_del(&link->cont_link_list); 457 list_del(&link->cgrp_link_list);
458 list_add(&link->cont_link_list, &cont->css_sets); 458 list_add(&link->cgrp_link_list, &cgrp->css_sets);
459 link->cg = res; 459 link->cg = res;
460 list_add(&link->cg_link_list, &res->cg_links); 460 list_add(&link->cg_link_list, &res->cg_links);
461 } 461 }
@@ -463,9 +463,9 @@ static struct css_set *find_css_set(
463 if (list_empty(&rootnode.subsys_list)) { 463 if (list_empty(&rootnode.subsys_list)) {
464 link = list_entry(tmp_cg_links.next, 464 link = list_entry(tmp_cg_links.next,
465 struct cg_cgroup_link, 465 struct cg_cgroup_link,
466 cont_link_list); 466 cgrp_link_list);
467 list_del(&link->cont_link_list); 467 list_del(&link->cgrp_link_list);
468 list_add(&link->cont_link_list, &dummytop->css_sets); 468 list_add(&link->cgrp_link_list, &dummytop->css_sets);
469 link->cg = res; 469 link->cg = res;
470 list_add(&link->cg_link_list, &res->cg_links); 470 list_add(&link->cg_link_list, &res->cg_links);
471 } 471 }
@@ -565,7 +565,7 @@ void cgroup_unlock(void)
565 565
566static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode); 566static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode);
567static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry); 567static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry);
568static int cgroup_populate_dir(struct cgroup *cont); 568static int cgroup_populate_dir(struct cgroup *cgrp);
569static struct inode_operations cgroup_dir_inode_operations; 569static struct inode_operations cgroup_dir_inode_operations;
570static struct file_operations proc_cgroupstats_operations; 570static struct file_operations proc_cgroupstats_operations;
571 571
@@ -592,8 +592,8 @@ static void cgroup_diput(struct dentry *dentry, struct inode *inode)
592{ 592{
593 /* is dentry a directory ? if so, kfree() associated cgroup */ 593 /* is dentry a directory ? if so, kfree() associated cgroup */
594 if (S_ISDIR(inode->i_mode)) { 594 if (S_ISDIR(inode->i_mode)) {
595 struct cgroup *cont = dentry->d_fsdata; 595 struct cgroup *cgrp = dentry->d_fsdata;
596 BUG_ON(!(cgroup_is_removed(cont))); 596 BUG_ON(!(cgroup_is_removed(cgrp)));
597 /* It's possible for external users to be holding css 597 /* It's possible for external users to be holding css
598 * reference counts on a cgroup; css_put() needs to 598 * reference counts on a cgroup; css_put() needs to
599 * be able to access the cgroup after decrementing 599 * be able to access the cgroup after decrementing
@@ -601,7 +601,7 @@ static void cgroup_diput(struct dentry *dentry, struct inode *inode)
601 * queue the cgroup to be handled by the release 601 * queue the cgroup to be handled by the release
602 * agent */ 602 * agent */
603 synchronize_rcu(); 603 synchronize_rcu();
604 kfree(cont); 604 kfree(cgrp);
605 } 605 }
606 iput(inode); 606 iput(inode);
607} 607}
@@ -658,7 +658,7 @@ static int rebind_subsystems(struct cgroupfs_root *root,
658 unsigned long final_bits) 658 unsigned long final_bits)
659{ 659{
660 unsigned long added_bits, removed_bits; 660 unsigned long added_bits, removed_bits;
661 struct cgroup *cont = &root->top_cgroup; 661 struct cgroup *cgrp = &root->top_cgroup;
662 int i; 662 int i;
663 663
664 removed_bits = root->actual_subsys_bits & ~final_bits; 664 removed_bits = root->actual_subsys_bits & ~final_bits;
@@ -679,7 +679,7 @@ static int rebind_subsystems(struct cgroupfs_root *root,
679 * any child cgroups exist. This is theoretically supportable 679 * any child cgroups exist. This is theoretically supportable
680 * but involves complex error handling, so it's being left until 680 * but involves complex error handling, so it's being left until
681 * later */ 681 * later */
682 if (!list_empty(&cont->children)) 682 if (!list_empty(&cgrp->children))
683 return -EBUSY; 683 return -EBUSY;
684 684
685 /* Process each subsystem */ 685 /* Process each subsystem */
@@ -688,32 +688,32 @@ static int rebind_subsystems(struct cgroupfs_root *root,
688 unsigned long bit = 1UL << i; 688 unsigned long bit = 1UL << i;
689 if (bit & added_bits) { 689 if (bit & added_bits) {
690 /* We're binding this subsystem to this hierarchy */ 690 /* We're binding this subsystem to this hierarchy */
691 BUG_ON(cont->subsys[i]); 691 BUG_ON(cgrp->subsys[i]);
692 BUG_ON(!dummytop->subsys[i]); 692 BUG_ON(!dummytop->subsys[i]);
693 BUG_ON(dummytop->subsys[i]->cgroup != dummytop); 693 BUG_ON(dummytop->subsys[i]->cgroup != dummytop);
694 cont->subsys[i] = dummytop->subsys[i]; 694 cgrp->subsys[i] = dummytop->subsys[i];
695 cont->subsys[i]->cgroup = cont; 695 cgrp->subsys[i]->cgroup = cgrp;
696 list_add(&ss->sibling, &root->subsys_list); 696 list_add(&ss->sibling, &root->subsys_list);
697 rcu_assign_pointer(ss->root, root); 697 rcu_assign_pointer(ss->root, root);
698 if (ss->bind) 698 if (ss->bind)
699 ss->bind(ss, cont); 699 ss->bind(ss, cgrp);
700 700
701 } else if (bit & removed_bits) { 701 } else if (bit & removed_bits) {
702 /* We're removing this subsystem */ 702 /* We're removing this subsystem */
703 BUG_ON(cont->subsys[i] != dummytop->subsys[i]); 703 BUG_ON(cgrp->subsys[i] != dummytop->subsys[i]);
704 BUG_ON(cont->subsys[i]->cgroup != cont); 704 BUG_ON(cgrp->subsys[i]->cgroup != cgrp);
705 if (ss->bind) 705 if (ss->bind)
706 ss->bind(ss, dummytop); 706 ss->bind(ss, dummytop);
707 dummytop->subsys[i]->cgroup = dummytop; 707 dummytop->subsys[i]->cgroup = dummytop;
708 cont->subsys[i] = NULL; 708 cgrp->subsys[i] = NULL;
709 rcu_assign_pointer(subsys[i]->root, &rootnode); 709 rcu_assign_pointer(subsys[i]->root, &rootnode);
710 list_del(&ss->sibling); 710 list_del(&ss->sibling);
711 } else if (bit & final_bits) { 711 } else if (bit & final_bits) {
712 /* Subsystem state should already exist */ 712 /* Subsystem state should already exist */
713 BUG_ON(!cont->subsys[i]); 713 BUG_ON(!cgrp->subsys[i]);
714 } else { 714 } else {
715 /* Subsystem state shouldn't exist */ 715 /* Subsystem state shouldn't exist */
716 BUG_ON(cont->subsys[i]); 716 BUG_ON(cgrp->subsys[i]);
717 } 717 }
718 } 718 }
719 root->subsys_bits = root->actual_subsys_bits = final_bits; 719 root->subsys_bits = root->actual_subsys_bits = final_bits;
@@ -797,10 +797,10 @@ static int cgroup_remount(struct super_block *sb, int *flags, char *data)
797{ 797{
798 int ret = 0; 798 int ret = 0;
799 struct cgroupfs_root *root = sb->s_fs_info; 799 struct cgroupfs_root *root = sb->s_fs_info;
800 struct cgroup *cont = &root->top_cgroup; 800 struct cgroup *cgrp = &root->top_cgroup;
801 struct cgroup_sb_opts opts; 801 struct cgroup_sb_opts opts;
802 802
803 mutex_lock(&cont->dentry->d_inode->i_mutex); 803 mutex_lock(&cgrp->dentry->d_inode->i_mutex);
804 mutex_lock(&cgroup_mutex); 804 mutex_lock(&cgroup_mutex);
805 805
806 /* See what subsystems are wanted */ 806 /* See what subsystems are wanted */
@@ -818,7 +818,7 @@ static int cgroup_remount(struct super_block *sb, int *flags, char *data)
818 818
819 /* (re)populate subsystem files */ 819 /* (re)populate subsystem files */
820 if (!ret) 820 if (!ret)
821 cgroup_populate_dir(cont); 821 cgroup_populate_dir(cgrp);
822 822
823 if (opts.release_agent) 823 if (opts.release_agent)
824 strcpy(root->release_agent_path, opts.release_agent); 824 strcpy(root->release_agent_path, opts.release_agent);
@@ -826,7 +826,7 @@ static int cgroup_remount(struct super_block *sb, int *flags, char *data)
826 if (opts.release_agent) 826 if (opts.release_agent)
827 kfree(opts.release_agent); 827 kfree(opts.release_agent);
828 mutex_unlock(&cgroup_mutex); 828 mutex_unlock(&cgroup_mutex);
829 mutex_unlock(&cont->dentry->d_inode->i_mutex); 829 mutex_unlock(&cgrp->dentry->d_inode->i_mutex);
830 return ret; 830 return ret;
831} 831}
832 832
@@ -839,16 +839,16 @@ static struct super_operations cgroup_ops = {
839 839
840static void init_cgroup_root(struct cgroupfs_root *root) 840static void init_cgroup_root(struct cgroupfs_root *root)
841{ 841{
842 struct cgroup *cont = &root->top_cgroup; 842 struct cgroup *cgrp = &root->top_cgroup;
843 INIT_LIST_HEAD(&root->subsys_list); 843 INIT_LIST_HEAD(&root->subsys_list);
844 INIT_LIST_HEAD(&root->root_list); 844 INIT_LIST_HEAD(&root->root_list);
845 root->number_of_cgroups = 1; 845 root->number_of_cgroups = 1;
846 cont->root = root; 846 cgrp->root = root;
847 cont->top_cgroup = cont; 847 cgrp->top_cgroup = cgrp;
848 INIT_LIST_HEAD(&cont->sibling); 848 INIT_LIST_HEAD(&cgrp->sibling);
849 INIT_LIST_HEAD(&cont->children); 849 INIT_LIST_HEAD(&cgrp->children);
850 INIT_LIST_HEAD(&cont->css_sets); 850 INIT_LIST_HEAD(&cgrp->css_sets);
851 INIT_LIST_HEAD(&cont->release_list); 851 INIT_LIST_HEAD(&cgrp->release_list);
852} 852}
853 853
854static int cgroup_test_super(struct super_block *sb, void *data) 854static int cgroup_test_super(struct super_block *sb, void *data)
@@ -955,7 +955,7 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
955 root = NULL; 955 root = NULL;
956 } else { 956 } else {
957 /* New superblock */ 957 /* New superblock */
958 struct cgroup *cont = &root->top_cgroup; 958 struct cgroup *cgrp = &root->top_cgroup;
959 struct inode *inode; 959 struct inode *inode;
960 960
961 BUG_ON(sb->s_root != NULL); 961 BUG_ON(sb->s_root != NULL);
@@ -1009,10 +1009,10 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
1009 BUG_ON(list_empty(&tmp_cg_links)); 1009 BUG_ON(list_empty(&tmp_cg_links));
1010 link = list_entry(tmp_cg_links.next, 1010 link = list_entry(tmp_cg_links.next,
1011 struct cg_cgroup_link, 1011 struct cg_cgroup_link,
1012 cont_link_list); 1012 cgrp_link_list);
1013 list_del(&link->cont_link_list); 1013 list_del(&link->cgrp_link_list);
1014 link->cg = cg; 1014 link->cg = cg;
1015 list_add(&link->cont_link_list, 1015 list_add(&link->cgrp_link_list,
1016 &root->top_cgroup.css_sets); 1016 &root->top_cgroup.css_sets);
1017 list_add(&link->cg_link_list, &cg->cg_links); 1017 list_add(&link->cg_link_list, &cg->cg_links);
1018 l = l->next; 1018 l = l->next;
@@ -1021,11 +1021,11 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
1021 1021
1022 free_cg_links(&tmp_cg_links); 1022 free_cg_links(&tmp_cg_links);
1023 1023
1024 BUG_ON(!list_empty(&cont->sibling)); 1024 BUG_ON(!list_empty(&cgrp->sibling));
1025 BUG_ON(!list_empty(&cont->children)); 1025 BUG_ON(!list_empty(&cgrp->children));
1026 BUG_ON(root->number_of_cgroups != 1); 1026 BUG_ON(root->number_of_cgroups != 1);
1027 1027
1028 cgroup_populate_dir(cont); 1028 cgroup_populate_dir(cgrp);
1029 mutex_unlock(&inode->i_mutex); 1029 mutex_unlock(&inode->i_mutex);
1030 mutex_unlock(&cgroup_mutex); 1030 mutex_unlock(&cgroup_mutex);
1031 } 1031 }
@@ -1041,14 +1041,14 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
1041 1041
1042static void cgroup_kill_sb(struct super_block *sb) { 1042static void cgroup_kill_sb(struct super_block *sb) {
1043 struct cgroupfs_root *root = sb->s_fs_info; 1043 struct cgroupfs_root *root = sb->s_fs_info;
1044 struct cgroup *cont = &root->top_cgroup; 1044 struct cgroup *cgrp = &root->top_cgroup;
1045 int ret; 1045 int ret;
1046 1046
1047 BUG_ON(!root); 1047 BUG_ON(!root);
1048 1048
1049 BUG_ON(root->number_of_cgroups != 1); 1049 BUG_ON(root->number_of_cgroups != 1);
1050 BUG_ON(!list_empty(&cont->children)); 1050 BUG_ON(!list_empty(&cgrp->children));
1051 BUG_ON(!list_empty(&cont->sibling)); 1051 BUG_ON(!list_empty(&cgrp->sibling));
1052 1052
1053 mutex_lock(&cgroup_mutex); 1053 mutex_lock(&cgroup_mutex);
1054 1054
@@ -1062,12 +1062,12 @@ static void cgroup_kill_sb(struct super_block *sb) {
1062 * root cgroup 1062 * root cgroup
1063 */ 1063 */
1064 write_lock(&css_set_lock); 1064 write_lock(&css_set_lock);
1065 while (!list_empty(&cont->css_sets)) { 1065 while (!list_empty(&cgrp->css_sets)) {
1066 struct cg_cgroup_link *link; 1066 struct cg_cgroup_link *link;
1067 link = list_entry(cont->css_sets.next, 1067 link = list_entry(cgrp->css_sets.next,
1068 struct cg_cgroup_link, cont_link_list); 1068 struct cg_cgroup_link, cgrp_link_list);
1069 list_del(&link->cg_link_list); 1069 list_del(&link->cg_link_list);
1070 list_del(&link->cont_link_list); 1070 list_del(&link->cgrp_link_list);
1071 kfree(link); 1071 kfree(link);
1072 } 1072 }
1073 write_unlock(&css_set_lock); 1073 write_unlock(&css_set_lock);
@@ -1088,7 +1088,7 @@ static struct file_system_type cgroup_fs_type = {
1088 .kill_sb = cgroup_kill_sb, 1088 .kill_sb = cgroup_kill_sb,
1089}; 1089};
1090 1090
1091static inline struct cgroup *__d_cont(struct dentry *dentry) 1091static inline struct cgroup *__d_cgrp(struct dentry *dentry)
1092{ 1092{
1093 return dentry->d_fsdata; 1093 return dentry->d_fsdata;
1094} 1094}
@@ -1102,11 +1102,11 @@ static inline struct cftype *__d_cft(struct dentry *dentry)
1102 * Called with cgroup_mutex held. Writes path of cgroup into buf. 1102 * Called with cgroup_mutex held. Writes path of cgroup into buf.
1103 * Returns 0 on success, -errno on error. 1103 * Returns 0 on success, -errno on error.
1104 */ 1104 */
1105int cgroup_path(const struct cgroup *cont, char *buf, int buflen) 1105int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen)
1106{ 1106{
1107 char *start; 1107 char *start;
1108 1108
1109 if (cont == dummytop) { 1109 if (cgrp == dummytop) {
1110 /* 1110 /*
1111 * Inactive subsystems have no dentry for their root 1111 * Inactive subsystems have no dentry for their root
1112 * cgroup 1112 * cgroup
@@ -1119,14 +1119,14 @@ int cgroup_path(const struct cgroup *cont, char *buf, int buflen)
1119 1119
1120 *--start = '\0'; 1120 *--start = '\0';
1121 for (;;) { 1121 for (;;) {
1122 int len = cont->dentry->d_name.len; 1122 int len = cgrp->dentry->d_name.len;
1123 if ((start -= len) < buf) 1123 if ((start -= len) < buf)
1124 return -ENAMETOOLONG; 1124 return -ENAMETOOLONG;
1125 memcpy(start, cont->dentry->d_name.name, len); 1125 memcpy(start, cgrp->dentry->d_name.name, len);
1126 cont = cont->parent; 1126 cgrp = cgrp->parent;
1127 if (!cont) 1127 if (!cgrp)
1128 break; 1128 break;
1129 if (!cont->parent) 1129 if (!cgrp->parent)
1130 continue; 1130 continue;
1131 if (--start < buf) 1131 if (--start < buf)
1132 return -ENAMETOOLONG; 1132 return -ENAMETOOLONG;
@@ -1141,16 +1141,16 @@ int cgroup_path(const struct cgroup *cont, char *buf, int buflen)
1141 * its subsystem id. 1141 * its subsystem id.
1142 */ 1142 */
1143 1143
1144static void get_first_subsys(const struct cgroup *cont, 1144static void get_first_subsys(const struct cgroup *cgrp,
1145 struct cgroup_subsys_state **css, int *subsys_id) 1145 struct cgroup_subsys_state **css, int *subsys_id)
1146{ 1146{
1147 const struct cgroupfs_root *root = cont->root; 1147 const struct cgroupfs_root *root = cgrp->root;
1148 const struct cgroup_subsys *test_ss; 1148 const struct cgroup_subsys *test_ss;
1149 BUG_ON(list_empty(&root->subsys_list)); 1149 BUG_ON(list_empty(&root->subsys_list));
1150 test_ss = list_entry(root->subsys_list.next, 1150 test_ss = list_entry(root->subsys_list.next,
1151 struct cgroup_subsys, sibling); 1151 struct cgroup_subsys, sibling);
1152 if (css) { 1152 if (css) {
1153 *css = cont->subsys[test_ss->subsys_id]; 1153 *css = cgrp->subsys[test_ss->subsys_id];
1154 BUG_ON(!*css); 1154 BUG_ON(!*css);
1155 } 1155 }
1156 if (subsys_id) 1156 if (subsys_id)
@@ -1158,31 +1158,31 @@ static void get_first_subsys(const struct cgroup *cont,
1158} 1158}
1159 1159
1160/* 1160/*
1161 * Attach task 'tsk' to cgroup 'cont' 1161 * Attach task 'tsk' to cgroup 'cgrp'
1162 * 1162 *
1163 * Call holding cgroup_mutex. May take task_lock of 1163 * Call holding cgroup_mutex. May take task_lock of
1164 * the task 'pid' during call. 1164 * the task 'pid' during call.
1165 */ 1165 */
1166static int attach_task(struct cgroup *cont, struct task_struct *tsk) 1166static int attach_task(struct cgroup *cgrp, struct task_struct *tsk)
1167{ 1167{
1168 int retval = 0; 1168 int retval = 0;
1169 struct cgroup_subsys *ss; 1169 struct cgroup_subsys *ss;
1170 struct cgroup *oldcont; 1170 struct cgroup *oldcgrp;
1171 struct css_set *cg = tsk->cgroups; 1171 struct css_set *cg = tsk->cgroups;
1172 struct css_set *newcg; 1172 struct css_set *newcg;
1173 struct cgroupfs_root *root = cont->root; 1173 struct cgroupfs_root *root = cgrp->root;
1174 int subsys_id; 1174 int subsys_id;
1175 1175
1176 get_first_subsys(cont, NULL, &subsys_id); 1176 get_first_subsys(cgrp, NULL, &subsys_id);
1177 1177
1178 /* Nothing to do if the task is already in that cgroup */ 1178 /* Nothing to do if the task is already in that cgroup */
1179 oldcont = task_cgroup(tsk, subsys_id); 1179 oldcgrp = task_cgroup(tsk, subsys_id);
1180 if (cont == oldcont) 1180 if (cgrp == oldcgrp)
1181 return 0; 1181 return 0;
1182 1182
1183 for_each_subsys(root, ss) { 1183 for_each_subsys(root, ss) {
1184 if (ss->can_attach) { 1184 if (ss->can_attach) {
1185 retval = ss->can_attach(ss, cont, tsk); 1185 retval = ss->can_attach(ss, cgrp, tsk);
1186 if (retval) { 1186 if (retval) {
1187 return retval; 1187 return retval;
1188 } 1188 }
@@ -1193,7 +1193,7 @@ static int attach_task(struct cgroup *cont, struct task_struct *tsk)
1193 * Locate or allocate a new css_set for this task, 1193 * Locate or allocate a new css_set for this task,
1194 * based on its final set of cgroups 1194 * based on its final set of cgroups
1195 */ 1195 */
1196 newcg = find_css_set(cg, cont); 1196 newcg = find_css_set(cg, cgrp);
1197 if (!newcg) { 1197 if (!newcg) {
1198 return -ENOMEM; 1198 return -ENOMEM;
1199 } 1199 }
@@ -1217,20 +1217,20 @@ static int attach_task(struct cgroup *cont, struct task_struct *tsk)
1217 1217
1218 for_each_subsys(root, ss) { 1218 for_each_subsys(root, ss) {
1219 if (ss->attach) { 1219 if (ss->attach) {
1220 ss->attach(ss, cont, oldcont, tsk); 1220 ss->attach(ss, cgrp, oldcgrp, tsk);
1221 } 1221 }
1222 } 1222 }
1223 set_bit(CONT_RELEASABLE, &oldcont->flags); 1223 set_bit(CGRP_RELEASABLE, &oldcgrp->flags);
1224 synchronize_rcu(); 1224 synchronize_rcu();
1225 put_css_set(cg); 1225 put_css_set(cg);
1226 return 0; 1226 return 0;
1227} 1227}
1228 1228
1229/* 1229/*
1230 * Attach task with pid 'pid' to cgroup 'cont'. Call with 1230 * Attach task with pid 'pid' to cgroup 'cgrp'. Call with
1231 * cgroup_mutex, may take task_lock of task 1231 * cgroup_mutex, may take task_lock of task
1232 */ 1232 */
1233static int attach_task_by_pid(struct cgroup *cont, char *pidbuf) 1233static int attach_task_by_pid(struct cgroup *cgrp, char *pidbuf)
1234{ 1234{
1235 pid_t pid; 1235 pid_t pid;
1236 struct task_struct *tsk; 1236 struct task_struct *tsk;
@@ -1259,7 +1259,7 @@ static int attach_task_by_pid(struct cgroup *cont, char *pidbuf)
1259 get_task_struct(tsk); 1259 get_task_struct(tsk);
1260 } 1260 }
1261 1261
1262 ret = attach_task(cont, tsk); 1262 ret = attach_task(cgrp, tsk);
1263 put_task_struct(tsk); 1263 put_task_struct(tsk);
1264 return ret; 1264 return ret;
1265} 1265}
@@ -1275,7 +1275,7 @@ enum cgroup_filetype {
1275 FILE_RELEASE_AGENT, 1275 FILE_RELEASE_AGENT,
1276}; 1276};
1277 1277
1278static ssize_t cgroup_write_uint(struct cgroup *cont, struct cftype *cft, 1278static ssize_t cgroup_write_uint(struct cgroup *cgrp, struct cftype *cft,
1279 struct file *file, 1279 struct file *file,
1280 const char __user *userbuf, 1280 const char __user *userbuf,
1281 size_t nbytes, loff_t *unused_ppos) 1281 size_t nbytes, loff_t *unused_ppos)
@@ -1302,13 +1302,13 @@ static ssize_t cgroup_write_uint(struct cgroup *cont, struct cftype *cft,
1302 return -EINVAL; 1302 return -EINVAL;
1303 1303
1304 /* Pass to subsystem */ 1304 /* Pass to subsystem */
1305 retval = cft->write_uint(cont, cft, val); 1305 retval = cft->write_uint(cgrp, cft, val);
1306 if (!retval) 1306 if (!retval)
1307 retval = nbytes; 1307 retval = nbytes;
1308 return retval; 1308 return retval;
1309} 1309}
1310 1310
1311static ssize_t cgroup_common_file_write(struct cgroup *cont, 1311static ssize_t cgroup_common_file_write(struct cgroup *cgrp,
1312 struct cftype *cft, 1312 struct cftype *cft,
1313 struct file *file, 1313 struct file *file,
1314 const char __user *userbuf, 1314 const char __user *userbuf,
@@ -1334,25 +1334,25 @@ static ssize_t cgroup_common_file_write(struct cgroup *cont,
1334 1334
1335 mutex_lock(&cgroup_mutex); 1335 mutex_lock(&cgroup_mutex);
1336 1336
1337 if (cgroup_is_removed(cont)) { 1337 if (cgroup_is_removed(cgrp)) {
1338 retval = -ENODEV; 1338 retval = -ENODEV;
1339 goto out2; 1339 goto out2;
1340 } 1340 }
1341 1341
1342 switch (type) { 1342 switch (type) {
1343 case FILE_TASKLIST: 1343 case FILE_TASKLIST:
1344 retval = attach_task_by_pid(cont, buffer); 1344 retval = attach_task_by_pid(cgrp, buffer);
1345 break; 1345 break;
1346 case FILE_NOTIFY_ON_RELEASE: 1346 case FILE_NOTIFY_ON_RELEASE:
1347 clear_bit(CONT_RELEASABLE, &cont->flags); 1347 clear_bit(CGRP_RELEASABLE, &cgrp->flags);
1348 if (simple_strtoul(buffer, NULL, 10) != 0) 1348 if (simple_strtoul(buffer, NULL, 10) != 0)
1349 set_bit(CONT_NOTIFY_ON_RELEASE, &cont->flags); 1349 set_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
1350 else 1350 else
1351 clear_bit(CONT_NOTIFY_ON_RELEASE, &cont->flags); 1351 clear_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
1352 break; 1352 break;
1353 case FILE_RELEASE_AGENT: 1353 case FILE_RELEASE_AGENT:
1354 { 1354 {
1355 struct cgroupfs_root *root = cont->root; 1355 struct cgroupfs_root *root = cgrp->root;
1356 /* Strip trailing newline */ 1356 /* Strip trailing newline */
1357 if (nbytes && (buffer[nbytes-1] == '\n')) { 1357 if (nbytes && (buffer[nbytes-1] == '\n')) {
1358 buffer[nbytes-1] = 0; 1358 buffer[nbytes-1] = 0;
@@ -1387,30 +1387,30 @@ static ssize_t cgroup_file_write(struct file *file, const char __user *buf,
1387 size_t nbytes, loff_t *ppos) 1387 size_t nbytes, loff_t *ppos)
1388{ 1388{
1389 struct cftype *cft = __d_cft(file->f_dentry); 1389 struct cftype *cft = __d_cft(file->f_dentry);
1390 struct cgroup *cont = __d_cont(file->f_dentry->d_parent); 1390 struct cgroup *cgrp = __d_cgrp(file->f_dentry->d_parent);
1391 1391
1392 if (!cft) 1392 if (!cft)
1393 return -ENODEV; 1393 return -ENODEV;
1394 if (cft->write) 1394 if (cft->write)
1395 return cft->write(cont, cft, file, buf, nbytes, ppos); 1395 return cft->write(cgrp, cft, file, buf, nbytes, ppos);
1396 if (cft->write_uint) 1396 if (cft->write_uint)
1397 return cgroup_write_uint(cont, cft, file, buf, nbytes, ppos); 1397 return cgroup_write_uint(cgrp, cft, file, buf, nbytes, ppos);
1398 return -EINVAL; 1398 return -EINVAL;
1399} 1399}
1400 1400
1401static ssize_t cgroup_read_uint(struct cgroup *cont, struct cftype *cft, 1401static ssize_t cgroup_read_uint(struct cgroup *cgrp, struct cftype *cft,
1402 struct file *file, 1402 struct file *file,
1403 char __user *buf, size_t nbytes, 1403 char __user *buf, size_t nbytes,
1404 loff_t *ppos) 1404 loff_t *ppos)
1405{ 1405{
1406 char tmp[64]; 1406 char tmp[64];
1407 u64 val = cft->read_uint(cont, cft); 1407 u64 val = cft->read_uint(cgrp, cft);
1408 int len = sprintf(tmp, "%llu\n", (unsigned long long) val); 1408 int len = sprintf(tmp, "%llu\n", (unsigned long long) val);
1409 1409
1410 return simple_read_from_buffer(buf, nbytes, ppos, tmp, len); 1410 return simple_read_from_buffer(buf, nbytes, ppos, tmp, len);
1411} 1411}
1412 1412
1413static ssize_t cgroup_common_file_read(struct cgroup *cont, 1413static ssize_t cgroup_common_file_read(struct cgroup *cgrp,
1414 struct cftype *cft, 1414 struct cftype *cft,
1415 struct file *file, 1415 struct file *file,
1416 char __user *buf, 1416 char __user *buf,
@@ -1432,7 +1432,7 @@ static ssize_t cgroup_common_file_read(struct cgroup *cont,
1432 struct cgroupfs_root *root; 1432 struct cgroupfs_root *root;
1433 size_t n; 1433 size_t n;
1434 mutex_lock(&cgroup_mutex); 1434 mutex_lock(&cgroup_mutex);
1435 root = cont->root; 1435 root = cgrp->root;
1436 n = strnlen(root->release_agent_path, 1436 n = strnlen(root->release_agent_path,
1437 sizeof(root->release_agent_path)); 1437 sizeof(root->release_agent_path));
1438 n = min(n, (size_t) PAGE_SIZE); 1438 n = min(n, (size_t) PAGE_SIZE);
@@ -1457,15 +1457,15 @@ static ssize_t cgroup_file_read(struct file *file, char __user *buf,
1457 size_t nbytes, loff_t *ppos) 1457 size_t nbytes, loff_t *ppos)
1458{ 1458{
1459 struct cftype *cft = __d_cft(file->f_dentry); 1459 struct cftype *cft = __d_cft(file->f_dentry);
1460 struct cgroup *cont = __d_cont(file->f_dentry->d_parent); 1460 struct cgroup *cgrp = __d_cgrp(file->f_dentry->d_parent);
1461 1461
1462 if (!cft) 1462 if (!cft)
1463 return -ENODEV; 1463 return -ENODEV;
1464 1464
1465 if (cft->read) 1465 if (cft->read)
1466 return cft->read(cont, cft, file, buf, nbytes, ppos); 1466 return cft->read(cgrp, cft, file, buf, nbytes, ppos);
1467 if (cft->read_uint) 1467 if (cft->read_uint)
1468 return cgroup_read_uint(cont, cft, file, buf, nbytes, ppos); 1468 return cgroup_read_uint(cgrp, cft, file, buf, nbytes, ppos);
1469 return -EINVAL; 1469 return -EINVAL;
1470} 1470}
1471 1471
@@ -1567,24 +1567,24 @@ static int cgroup_create_file(struct dentry *dentry, int mode,
1567 1567
1568/* 1568/*
1569 * cgroup_create_dir - create a directory for an object. 1569 * cgroup_create_dir - create a directory for an object.
1570 * cont: the cgroup we create the directory for. 1570 * cgrp: the cgroup we create the directory for.
1571 * It must have a valid ->parent field 1571 * It must have a valid ->parent field
1572 * And we are going to fill its ->dentry field. 1572 * And we are going to fill its ->dentry field.
1573 * dentry: dentry of the new container 1573 * dentry: dentry of the new cgroup
1574 * mode: mode to set on new directory. 1574 * mode: mode to set on new directory.
1575 */ 1575 */
1576static int cgroup_create_dir(struct cgroup *cont, struct dentry *dentry, 1576static int cgroup_create_dir(struct cgroup *cgrp, struct dentry *dentry,
1577 int mode) 1577 int mode)
1578{ 1578{
1579 struct dentry *parent; 1579 struct dentry *parent;
1580 int error = 0; 1580 int error = 0;
1581 1581
1582 parent = cont->parent->dentry; 1582 parent = cgrp->parent->dentry;
1583 error = cgroup_create_file(dentry, S_IFDIR | mode, cont->root->sb); 1583 error = cgroup_create_file(dentry, S_IFDIR | mode, cgrp->root->sb);
1584 if (!error) { 1584 if (!error) {
1585 dentry->d_fsdata = cont; 1585 dentry->d_fsdata = cgrp;
1586 inc_nlink(parent->d_inode); 1586 inc_nlink(parent->d_inode);
1587 cont->dentry = dentry; 1587 cgrp->dentry = dentry;
1588 dget(dentry); 1588 dget(dentry);
1589 } 1589 }
1590 dput(dentry); 1590 dput(dentry);
@@ -1592,16 +1592,16 @@ static int cgroup_create_dir(struct cgroup *cont, struct dentry *dentry,
1592 return error; 1592 return error;
1593} 1593}
1594 1594
1595int cgroup_add_file(struct cgroup *cont, 1595int cgroup_add_file(struct cgroup *cgrp,
1596 struct cgroup_subsys *subsys, 1596 struct cgroup_subsys *subsys,
1597 const struct cftype *cft) 1597 const struct cftype *cft)
1598{ 1598{
1599 struct dentry *dir = cont->dentry; 1599 struct dentry *dir = cgrp->dentry;
1600 struct dentry *dentry; 1600 struct dentry *dentry;
1601 int error; 1601 int error;
1602 1602
1603 char name[MAX_CGROUP_TYPE_NAMELEN + MAX_CFTYPE_NAME + 2] = { 0 }; 1603 char name[MAX_CGROUP_TYPE_NAMELEN + MAX_CFTYPE_NAME + 2] = { 0 };
1604 if (subsys && !test_bit(ROOT_NOPREFIX, &cont->root->flags)) { 1604 if (subsys && !test_bit(ROOT_NOPREFIX, &cgrp->root->flags)) {
1605 strcpy(name, subsys->name); 1605 strcpy(name, subsys->name);
1606 strcat(name, "."); 1606 strcat(name, ".");
1607 } 1607 }
@@ -1610,7 +1610,7 @@ int cgroup_add_file(struct cgroup *cont,
1610 dentry = lookup_one_len(name, dir, strlen(name)); 1610 dentry = lookup_one_len(name, dir, strlen(name));
1611 if (!IS_ERR(dentry)) { 1611 if (!IS_ERR(dentry)) {
1612 error = cgroup_create_file(dentry, 0644 | S_IFREG, 1612 error = cgroup_create_file(dentry, 0644 | S_IFREG,
1613 cont->root->sb); 1613 cgrp->root->sb);
1614 if (!error) 1614 if (!error)
1615 dentry->d_fsdata = (void *)cft; 1615 dentry->d_fsdata = (void *)cft;
1616 dput(dentry); 1616 dput(dentry);
@@ -1619,14 +1619,14 @@ int cgroup_add_file(struct cgroup *cont,
1619 return error; 1619 return error;
1620} 1620}
1621 1621
1622int cgroup_add_files(struct cgroup *cont, 1622int cgroup_add_files(struct cgroup *cgrp,
1623 struct cgroup_subsys *subsys, 1623 struct cgroup_subsys *subsys,
1624 const struct cftype cft[], 1624 const struct cftype cft[],
1625 int count) 1625 int count)
1626{ 1626{
1627 int i, err; 1627 int i, err;
1628 for (i = 0; i < count; i++) { 1628 for (i = 0; i < count; i++) {
1629 err = cgroup_add_file(cont, subsys, &cft[i]); 1629 err = cgroup_add_file(cgrp, subsys, &cft[i]);
1630 if (err) 1630 if (err)
1631 return err; 1631 return err;
1632 } 1632 }
@@ -1635,16 +1635,16 @@ int cgroup_add_files(struct cgroup *cont,
1635 1635
1636/* Count the number of tasks in a cgroup. */ 1636/* Count the number of tasks in a cgroup. */
1637 1637
1638int cgroup_task_count(const struct cgroup *cont) 1638int cgroup_task_count(const struct cgroup *cgrp)
1639{ 1639{
1640 int count = 0; 1640 int count = 0;
1641 struct list_head *l; 1641 struct list_head *l;
1642 1642
1643 read_lock(&css_set_lock); 1643 read_lock(&css_set_lock);
1644 l = cont->css_sets.next; 1644 l = cgrp->css_sets.next;
1645 while (l != &cont->css_sets) { 1645 while (l != &cgrp->css_sets) {
1646 struct cg_cgroup_link *link = 1646 struct cg_cgroup_link *link =
1647 list_entry(l, struct cg_cgroup_link, cont_link_list); 1647 list_entry(l, struct cg_cgroup_link, cgrp_link_list);
1648 count += atomic_read(&link->cg->ref.refcount); 1648 count += atomic_read(&link->cg->ref.refcount);
1649 l = l->next; 1649 l = l->next;
1650 } 1650 }
@@ -1656,7 +1656,7 @@ int cgroup_task_count(const struct cgroup *cont)
1656 * Advance a list_head iterator. The iterator should be positioned at 1656 * Advance a list_head iterator. The iterator should be positioned at
1657 * the start of a css_set 1657 * the start of a css_set
1658 */ 1658 */
1659static void cgroup_advance_iter(struct cgroup *cont, 1659static void cgroup_advance_iter(struct cgroup *cgrp,
1660 struct cgroup_iter *it) 1660 struct cgroup_iter *it)
1661{ 1661{
1662 struct list_head *l = it->cg_link; 1662 struct list_head *l = it->cg_link;
@@ -1666,18 +1666,18 @@ static void cgroup_advance_iter(struct cgroup *cont,
1666 /* Advance to the next non-empty css_set */ 1666 /* Advance to the next non-empty css_set */
1667 do { 1667 do {
1668 l = l->next; 1668 l = l->next;
1669 if (l == &cont->css_sets) { 1669 if (l == &cgrp->css_sets) {
1670 it->cg_link = NULL; 1670 it->cg_link = NULL;
1671 return; 1671 return;
1672 } 1672 }
1673 link = list_entry(l, struct cg_cgroup_link, cont_link_list); 1673 link = list_entry(l, struct cg_cgroup_link, cgrp_link_list);
1674 cg = link->cg; 1674 cg = link->cg;
1675 } while (list_empty(&cg->tasks)); 1675 } while (list_empty(&cg->tasks));
1676 it->cg_link = l; 1676 it->cg_link = l;
1677 it->task = cg->tasks.next; 1677 it->task = cg->tasks.next;
1678} 1678}
1679 1679
1680void cgroup_iter_start(struct cgroup *cont, struct cgroup_iter *it) 1680void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it)
1681{ 1681{
1682 /* 1682 /*
1683 * The first time anyone tries to iterate across a cgroup, 1683 * The first time anyone tries to iterate across a cgroup,
@@ -1697,11 +1697,11 @@ void cgroup_iter_start(struct cgroup *cont, struct cgroup_iter *it)
1697 write_unlock(&css_set_lock); 1697 write_unlock(&css_set_lock);
1698 } 1698 }
1699 read_lock(&css_set_lock); 1699 read_lock(&css_set_lock);
1700 it->cg_link = &cont->css_sets; 1700 it->cg_link = &cgrp->css_sets;
1701 cgroup_advance_iter(cont, it); 1701 cgroup_advance_iter(cgrp, it);
1702} 1702}
1703 1703
1704struct task_struct *cgroup_iter_next(struct cgroup *cont, 1704struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
1705 struct cgroup_iter *it) 1705 struct cgroup_iter *it)
1706{ 1706{
1707 struct task_struct *res; 1707 struct task_struct *res;
@@ -1716,14 +1716,14 @@ struct task_struct *cgroup_iter_next(struct cgroup *cont,
1716 if (l == &res->cgroups->tasks) { 1716 if (l == &res->cgroups->tasks) {
1717 /* We reached the end of this task list - move on to 1717 /* We reached the end of this task list - move on to
1718 * the next cg_cgroup_link */ 1718 * the next cg_cgroup_link */
1719 cgroup_advance_iter(cont, it); 1719 cgroup_advance_iter(cgrp, it);
1720 } else { 1720 } else {
1721 it->task = l; 1721 it->task = l;
1722 } 1722 }
1723 return res; 1723 return res;
1724} 1724}
1725 1725
1726void cgroup_iter_end(struct cgroup *cont, struct cgroup_iter *it) 1726void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it)
1727{ 1727{
1728 read_unlock(&css_set_lock); 1728 read_unlock(&css_set_lock);
1729} 1729}
@@ -1749,23 +1749,23 @@ struct ctr_struct {
1749 1749
1750/* 1750/*
1751 * Load into 'pidarray' up to 'npids' of the tasks using cgroup 1751 * Load into 'pidarray' up to 'npids' of the tasks using cgroup
1752 * 'cont'. Return actual number of pids loaded. No need to 1752 * 'cgrp'. Return actual number of pids loaded. No need to
1753 * task_lock(p) when reading out p->cgroup, since we're in an RCU 1753 * task_lock(p) when reading out p->cgroup, since we're in an RCU
1754 * read section, so the css_set can't go away, and is 1754 * read section, so the css_set can't go away, and is
1755 * immutable after creation. 1755 * immutable after creation.
1756 */ 1756 */
1757static int pid_array_load(pid_t *pidarray, int npids, struct cgroup *cont) 1757static int pid_array_load(pid_t *pidarray, int npids, struct cgroup *cgrp)
1758{ 1758{
1759 int n = 0; 1759 int n = 0;
1760 struct cgroup_iter it; 1760 struct cgroup_iter it;
1761 struct task_struct *tsk; 1761 struct task_struct *tsk;
1762 cgroup_iter_start(cont, &it); 1762 cgroup_iter_start(cgrp, &it);
1763 while ((tsk = cgroup_iter_next(cont, &it))) { 1763 while ((tsk = cgroup_iter_next(cgrp, &it))) {
1764 if (unlikely(n == npids)) 1764 if (unlikely(n == npids))
1765 break; 1765 break;
1766 pidarray[n++] = task_pid_nr(tsk); 1766 pidarray[n++] = task_pid_nr(tsk);
1767 } 1767 }
1768 cgroup_iter_end(cont, &it); 1768 cgroup_iter_end(cgrp, &it);
1769 return n; 1769 return n;
1770} 1770}
1771 1771
@@ -1780,7 +1780,7 @@ static int pid_array_load(pid_t *pidarray, int npids, struct cgroup *cont)
1780int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry) 1780int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry)
1781{ 1781{
1782 int ret = -EINVAL; 1782 int ret = -EINVAL;
1783 struct cgroup *cont; 1783 struct cgroup *cgrp;
1784 struct cgroup_iter it; 1784 struct cgroup_iter it;
1785 struct task_struct *tsk; 1785 struct task_struct *tsk;
1786 /* 1786 /*
@@ -1790,11 +1790,11 @@ int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry)
1790 goto err; 1790 goto err;
1791 1791
1792 ret = 0; 1792 ret = 0;
1793 cont = dentry->d_fsdata; 1793 cgrp = dentry->d_fsdata;
1794 rcu_read_lock(); 1794 rcu_read_lock();
1795 1795
1796 cgroup_iter_start(cont, &it); 1796 cgroup_iter_start(cgrp, &it);
1797 while ((tsk = cgroup_iter_next(cont, &it))) { 1797 while ((tsk = cgroup_iter_next(cgrp, &it))) {
1798 switch (tsk->state) { 1798 switch (tsk->state) {
1799 case TASK_RUNNING: 1799 case TASK_RUNNING:
1800 stats->nr_running++; 1800 stats->nr_running++;
@@ -1814,7 +1814,7 @@ int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry)
1814 break; 1814 break;
1815 } 1815 }
1816 } 1816 }
1817 cgroup_iter_end(cont, &it); 1817 cgroup_iter_end(cgrp, &it);
1818 1818
1819 rcu_read_unlock(); 1819 rcu_read_unlock();
1820err: 1820err:
@@ -1849,7 +1849,7 @@ static int pid_array_to_buf(char *buf, int sz, pid_t *a, int npids)
1849 */ 1849 */
1850static int cgroup_tasks_open(struct inode *unused, struct file *file) 1850static int cgroup_tasks_open(struct inode *unused, struct file *file)
1851{ 1851{
1852 struct cgroup *cont = __d_cont(file->f_dentry->d_parent); 1852 struct cgroup *cgrp = __d_cgrp(file->f_dentry->d_parent);
1853 struct ctr_struct *ctr; 1853 struct ctr_struct *ctr;
1854 pid_t *pidarray; 1854 pid_t *pidarray;
1855 int npids; 1855 int npids;
@@ -1868,13 +1868,13 @@ static int cgroup_tasks_open(struct inode *unused, struct file *file)
1868 * caller from the case that the additional cgroup users didn't 1868 * caller from the case that the additional cgroup users didn't
1869 * show up until sometime later on. 1869 * show up until sometime later on.
1870 */ 1870 */
1871 npids = cgroup_task_count(cont); 1871 npids = cgroup_task_count(cgrp);
1872 if (npids) { 1872 if (npids) {
1873 pidarray = kmalloc(npids * sizeof(pid_t), GFP_KERNEL); 1873 pidarray = kmalloc(npids * sizeof(pid_t), GFP_KERNEL);
1874 if (!pidarray) 1874 if (!pidarray)
1875 goto err1; 1875 goto err1;
1876 1876
1877 npids = pid_array_load(pidarray, npids, cont); 1877 npids = pid_array_load(pidarray, npids, cgrp);
1878 sort(pidarray, npids, sizeof(pid_t), cmppid, NULL); 1878 sort(pidarray, npids, sizeof(pid_t), cmppid, NULL);
1879 1879
1880 /* Call pid_array_to_buf() twice, first just to get bufsz */ 1880 /* Call pid_array_to_buf() twice, first just to get bufsz */
@@ -1900,7 +1900,7 @@ err0:
1900 return -ENOMEM; 1900 return -ENOMEM;
1901} 1901}
1902 1902
1903static ssize_t cgroup_tasks_read(struct cgroup *cont, 1903static ssize_t cgroup_tasks_read(struct cgroup *cgrp,
1904 struct cftype *cft, 1904 struct cftype *cft,
1905 struct file *file, char __user *buf, 1905 struct file *file, char __user *buf,
1906 size_t nbytes, loff_t *ppos) 1906 size_t nbytes, loff_t *ppos)
@@ -1923,15 +1923,15 @@ static int cgroup_tasks_release(struct inode *unused_inode,
1923 return 0; 1923 return 0;
1924} 1924}
1925 1925
1926static u64 cgroup_read_notify_on_release(struct cgroup *cont, 1926static u64 cgroup_read_notify_on_release(struct cgroup *cgrp,
1927 struct cftype *cft) 1927 struct cftype *cft)
1928{ 1928{
1929 return notify_on_release(cont); 1929 return notify_on_release(cgrp);
1930} 1930}
1931 1931
1932static u64 cgroup_read_releasable(struct cgroup *cont, struct cftype *cft) 1932static u64 cgroup_read_releasable(struct cgroup *cgrp, struct cftype *cft)
1933{ 1933{
1934 return test_bit(CONT_RELEASABLE, &cont->flags); 1934 return test_bit(CGRP_RELEASABLE, &cgrp->flags);
1935} 1935}
1936 1936
1937/* 1937/*
@@ -1968,25 +1968,25 @@ static struct cftype cft_release_agent = {
1968 .private = FILE_RELEASE_AGENT, 1968 .private = FILE_RELEASE_AGENT,
1969}; 1969};
1970 1970
1971static int cgroup_populate_dir(struct cgroup *cont) 1971static int cgroup_populate_dir(struct cgroup *cgrp)
1972{ 1972{
1973 int err; 1973 int err;
1974 struct cgroup_subsys *ss; 1974 struct cgroup_subsys *ss;
1975 1975
1976 /* First clear out any existing files */ 1976 /* First clear out any existing files */
1977 cgroup_clear_directory(cont->dentry); 1977 cgroup_clear_directory(cgrp->dentry);
1978 1978
1979 err = cgroup_add_files(cont, NULL, files, ARRAY_SIZE(files)); 1979 err = cgroup_add_files(cgrp, NULL, files, ARRAY_SIZE(files));
1980 if (err < 0) 1980 if (err < 0)
1981 return err; 1981 return err;
1982 1982
1983 if (cont == cont->top_cgroup) { 1983 if (cgrp == cgrp->top_cgroup) {
1984 if ((err = cgroup_add_file(cont, NULL, &cft_release_agent)) < 0) 1984 if ((err = cgroup_add_file(cgrp, NULL, &cft_release_agent)) < 0)
1985 return err; 1985 return err;
1986 } 1986 }
1987 1987
1988 for_each_subsys(cont->root, ss) { 1988 for_each_subsys(cgrp->root, ss) {
1989 if (ss->populate && (err = ss->populate(ss, cont)) < 0) 1989 if (ss->populate && (err = ss->populate(ss, cgrp)) < 0)
1990 return err; 1990 return err;
1991 } 1991 }
1992 1992
@@ -1995,15 +1995,15 @@ static int cgroup_populate_dir(struct cgroup *cont)
1995 1995
1996static void init_cgroup_css(struct cgroup_subsys_state *css, 1996static void init_cgroup_css(struct cgroup_subsys_state *css,
1997 struct cgroup_subsys *ss, 1997 struct cgroup_subsys *ss,
1998 struct cgroup *cont) 1998 struct cgroup *cgrp)
1999{ 1999{
2000 css->cgroup = cont; 2000 css->cgroup = cgrp;
2001 atomic_set(&css->refcnt, 0); 2001 atomic_set(&css->refcnt, 0);
2002 css->flags = 0; 2002 css->flags = 0;
2003 if (cont == dummytop) 2003 if (cgrp == dummytop)
2004 set_bit(CSS_ROOT, &css->flags); 2004 set_bit(CSS_ROOT, &css->flags);
2005 BUG_ON(cont->subsys[ss->subsys_id]); 2005 BUG_ON(cgrp->subsys[ss->subsys_id]);
2006 cont->subsys[ss->subsys_id] = css; 2006 cgrp->subsys[ss->subsys_id] = css;
2007} 2007}
2008 2008
2009/* 2009/*
@@ -2018,14 +2018,14 @@ static void init_cgroup_css(struct cgroup_subsys_state *css,
2018static long cgroup_create(struct cgroup *parent, struct dentry *dentry, 2018static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
2019 int mode) 2019 int mode)
2020{ 2020{
2021 struct cgroup *cont; 2021 struct cgroup *cgrp;
2022 struct cgroupfs_root *root = parent->root; 2022 struct cgroupfs_root *root = parent->root;
2023 int err = 0; 2023 int err = 0;
2024 struct cgroup_subsys *ss; 2024 struct cgroup_subsys *ss;
2025 struct super_block *sb = root->sb; 2025 struct super_block *sb = root->sb;
2026 2026
2027 cont = kzalloc(sizeof(*cont), GFP_KERNEL); 2027 cgrp = kzalloc(sizeof(*cgrp), GFP_KERNEL);
2028 if (!cont) 2028 if (!cgrp)
2029 return -ENOMEM; 2029 return -ENOMEM;
2030 2030
2031 /* Grab a reference on the superblock so the hierarchy doesn't 2031 /* Grab a reference on the superblock so the hierarchy doesn't
@@ -2037,53 +2037,53 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
2037 2037
2038 mutex_lock(&cgroup_mutex); 2038 mutex_lock(&cgroup_mutex);
2039 2039
2040 cont->flags = 0; 2040 cgrp->flags = 0;
2041 INIT_LIST_HEAD(&cont->sibling); 2041 INIT_LIST_HEAD(&cgrp->sibling);
2042 INIT_LIST_HEAD(&cont->children); 2042 INIT_LIST_HEAD(&cgrp->children);
2043 INIT_LIST_HEAD(&cont->css_sets); 2043 INIT_LIST_HEAD(&cgrp->css_sets);
2044 INIT_LIST_HEAD(&cont->release_list); 2044 INIT_LIST_HEAD(&cgrp->release_list);
2045 2045
2046 cont->parent = parent; 2046 cgrp->parent = parent;
2047 cont->root = parent->root; 2047 cgrp->root = parent->root;
2048 cont->top_cgroup = parent->top_cgroup; 2048 cgrp->top_cgroup = parent->top_cgroup;
2049 2049
2050 for_each_subsys(root, ss) { 2050 for_each_subsys(root, ss) {
2051 struct cgroup_subsys_state *css = ss->create(ss, cont); 2051 struct cgroup_subsys_state *css = ss->create(ss, cgrp);
2052 if (IS_ERR(css)) { 2052 if (IS_ERR(css)) {
2053 err = PTR_ERR(css); 2053 err = PTR_ERR(css);
2054 goto err_destroy; 2054 goto err_destroy;
2055 } 2055 }
2056 init_cgroup_css(css, ss, cont); 2056 init_cgroup_css(css, ss, cgrp);
2057 } 2057 }
2058 2058
2059 list_add(&cont->sibling, &cont->parent->children); 2059 list_add(&cgrp->sibling, &cgrp->parent->children);
2060 root->number_of_cgroups++; 2060 root->number_of_cgroups++;
2061 2061
2062 err = cgroup_create_dir(cont, dentry, mode); 2062 err = cgroup_create_dir(cgrp, dentry, mode);
2063 if (err < 0) 2063 if (err < 0)
2064 goto err_remove; 2064 goto err_remove;
2065 2065
2066 /* The cgroup directory was pre-locked for us */ 2066 /* The cgroup directory was pre-locked for us */
2067 BUG_ON(!mutex_is_locked(&cont->dentry->d_inode->i_mutex)); 2067 BUG_ON(!mutex_is_locked(&cgrp->dentry->d_inode->i_mutex));
2068 2068
2069 err = cgroup_populate_dir(cont); 2069 err = cgroup_populate_dir(cgrp);
2070 /* If err < 0, we have a half-filled directory - oh well ;) */ 2070 /* If err < 0, we have a half-filled directory - oh well ;) */
2071 2071
2072 mutex_unlock(&cgroup_mutex); 2072 mutex_unlock(&cgroup_mutex);
2073 mutex_unlock(&cont->dentry->d_inode->i_mutex); 2073 mutex_unlock(&cgrp->dentry->d_inode->i_mutex);
2074 2074
2075 return 0; 2075 return 0;
2076 2076
2077 err_remove: 2077 err_remove:
2078 2078
2079 list_del(&cont->sibling); 2079 list_del(&cgrp->sibling);
2080 root->number_of_cgroups--; 2080 root->number_of_cgroups--;
2081 2081
2082 err_destroy: 2082 err_destroy:
2083 2083
2084 for_each_subsys(root, ss) { 2084 for_each_subsys(root, ss) {
2085 if (cont->subsys[ss->subsys_id]) 2085 if (cgrp->subsys[ss->subsys_id])
2086 ss->destroy(ss, cont); 2086 ss->destroy(ss, cgrp);
2087 } 2087 }
2088 2088
2089 mutex_unlock(&cgroup_mutex); 2089 mutex_unlock(&cgroup_mutex);
@@ -2091,7 +2091,7 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
2091 /* Release the reference count that we took on the superblock */ 2091 /* Release the reference count that we took on the superblock */
2092 deactivate_super(sb); 2092 deactivate_super(sb);
2093 2093
2094 kfree(cont); 2094 kfree(cgrp);
2095 return err; 2095 return err;
2096} 2096}
2097 2097
@@ -2103,7 +2103,7 @@ static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode)
2103 return cgroup_create(c_parent, dentry, mode | S_IFDIR); 2103 return cgroup_create(c_parent, dentry, mode | S_IFDIR);
2104} 2104}
2105 2105
2106static inline int cgroup_has_css_refs(struct cgroup *cont) 2106static inline int cgroup_has_css_refs(struct cgroup *cgrp)
2107{ 2107{
2108 /* Check the reference count on each subsystem. Since we 2108 /* Check the reference count on each subsystem. Since we
2109 * already established that there are no tasks in the 2109 * already established that there are no tasks in the
@@ -2119,9 +2119,9 @@ static inline int cgroup_has_css_refs(struct cgroup *cont)
2119 struct cgroup_subsys *ss = subsys[i]; 2119 struct cgroup_subsys *ss = subsys[i];
2120 struct cgroup_subsys_state *css; 2120 struct cgroup_subsys_state *css;
2121 /* Skip subsystems not in this hierarchy */ 2121 /* Skip subsystems not in this hierarchy */
2122 if (ss->root != cont->root) 2122 if (ss->root != cgrp->root)
2123 continue; 2123 continue;
2124 css = cont->subsys[ss->subsys_id]; 2124 css = cgrp->subsys[ss->subsys_id];
2125 /* When called from check_for_release() it's possible 2125 /* When called from check_for_release() it's possible
2126 * that by this point the cgroup has been removed 2126 * that by this point the cgroup has been removed
2127 * and the css deleted. But a false-positive doesn't 2127 * and the css deleted. But a false-positive doesn't
@@ -2137,7 +2137,7 @@ static inline int cgroup_has_css_refs(struct cgroup *cont)
2137 2137
2138static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry) 2138static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry)
2139{ 2139{
2140 struct cgroup *cont = dentry->d_fsdata; 2140 struct cgroup *cgrp = dentry->d_fsdata;
2141 struct dentry *d; 2141 struct dentry *d;
2142 struct cgroup *parent; 2142 struct cgroup *parent;
2143 struct cgroup_subsys *ss; 2143 struct cgroup_subsys *ss;
@@ -2147,46 +2147,46 @@ static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry)
2147 /* the vfs holds both inode->i_mutex already */ 2147 /* the vfs holds both inode->i_mutex already */
2148 2148
2149 mutex_lock(&cgroup_mutex); 2149 mutex_lock(&cgroup_mutex);
2150 if (atomic_read(&cont->count) != 0) { 2150 if (atomic_read(&cgrp->count) != 0) {
2151 mutex_unlock(&cgroup_mutex); 2151 mutex_unlock(&cgroup_mutex);
2152 return -EBUSY; 2152 return -EBUSY;
2153 } 2153 }
2154 if (!list_empty(&cont->children)) { 2154 if (!list_empty(&cgrp->children)) {
2155 mutex_unlock(&cgroup_mutex); 2155 mutex_unlock(&cgroup_mutex);
2156 return -EBUSY; 2156 return -EBUSY;
2157 } 2157 }
2158 2158
2159 parent = cont->parent; 2159 parent = cgrp->parent;
2160 root = cont->root; 2160 root = cgrp->root;
2161 sb = root->sb; 2161 sb = root->sb;
2162 2162
2163 if (cgroup_has_css_refs(cont)) { 2163 if (cgroup_has_css_refs(cgrp)) {
2164 mutex_unlock(&cgroup_mutex); 2164 mutex_unlock(&cgroup_mutex);
2165 return -EBUSY; 2165 return -EBUSY;
2166 } 2166 }
2167 2167
2168 for_each_subsys(root, ss) { 2168 for_each_subsys(root, ss) {
2169 if (cont->subsys[ss->subsys_id]) 2169 if (cgrp->subsys[ss->subsys_id])
2170 ss->destroy(ss, cont); 2170 ss->destroy(ss, cgrp);
2171 } 2171 }
2172 2172
2173 spin_lock(&release_list_lock); 2173 spin_lock(&release_list_lock);
2174 set_bit(CONT_REMOVED, &cont->flags); 2174 set_bit(CGRP_REMOVED, &cgrp->flags);
2175 if (!list_empty(&cont->release_list)) 2175 if (!list_empty(&cgrp->release_list))
2176 list_del(&cont->release_list); 2176 list_del(&cgrp->release_list);
2177 spin_unlock(&release_list_lock); 2177 spin_unlock(&release_list_lock);
2178 /* delete my sibling from parent->children */ 2178 /* delete my sibling from parent->children */
2179 list_del(&cont->sibling); 2179 list_del(&cgrp->sibling);
2180 spin_lock(&cont->dentry->d_lock); 2180 spin_lock(&cgrp->dentry->d_lock);
2181 d = dget(cont->dentry); 2181 d = dget(cgrp->dentry);
2182 cont->dentry = NULL; 2182 cgrp->dentry = NULL;
2183 spin_unlock(&d->d_lock); 2183 spin_unlock(&d->d_lock);
2184 2184
2185 cgroup_d_remove_dir(d); 2185 cgroup_d_remove_dir(d);
2186 dput(d); 2186 dput(d);
2187 root->number_of_cgroups--; 2187 root->number_of_cgroups--;
2188 2188
2189 set_bit(CONT_RELEASABLE, &parent->flags); 2189 set_bit(CGRP_RELEASABLE, &parent->flags);
2190 check_for_release(parent); 2190 check_for_release(parent);
2191 2191
2192 mutex_unlock(&cgroup_mutex); 2192 mutex_unlock(&cgroup_mutex);
@@ -2260,7 +2260,7 @@ int __init cgroup_init_early(void)
2260 init_task.cgroups = &init_css_set; 2260 init_task.cgroups = &init_css_set;
2261 2261
2262 init_css_set_link.cg = &init_css_set; 2262 init_css_set_link.cg = &init_css_set;
2263 list_add(&init_css_set_link.cont_link_list, 2263 list_add(&init_css_set_link.cgrp_link_list,
2264 &rootnode.top_cgroup.css_sets); 2264 &rootnode.top_cgroup.css_sets);
2265 list_add(&init_css_set_link.cg_link_list, 2265 list_add(&init_css_set_link.cg_link_list,
2266 &init_css_set.cg_links); 2266 &init_css_set.cg_links);
@@ -2357,7 +2357,7 @@ static int proc_cgroup_show(struct seq_file *m, void *v)
2357 2357
2358 for_each_root(root) { 2358 for_each_root(root) {
2359 struct cgroup_subsys *ss; 2359 struct cgroup_subsys *ss;
2360 struct cgroup *cont; 2360 struct cgroup *cgrp;
2361 int subsys_id; 2361 int subsys_id;
2362 int count = 0; 2362 int count = 0;
2363 2363
@@ -2368,8 +2368,8 @@ static int proc_cgroup_show(struct seq_file *m, void *v)
2368 seq_printf(m, "%s%s", count++ ? "," : "", ss->name); 2368 seq_printf(m, "%s%s", count++ ? "," : "", ss->name);
2369 seq_putc(m, ':'); 2369 seq_putc(m, ':');
2370 get_first_subsys(&root->top_cgroup, NULL, &subsys_id); 2370 get_first_subsys(&root->top_cgroup, NULL, &subsys_id);
2371 cont = task_cgroup(tsk, subsys_id); 2371 cgrp = task_cgroup(tsk, subsys_id);
2372 retval = cgroup_path(cont, buf, PAGE_SIZE); 2372 retval = cgroup_path(cgrp, buf, PAGE_SIZE);
2373 if (retval < 0) 2373 if (retval < 0)
2374 goto out_unlock; 2374 goto out_unlock;
2375 seq_puts(m, buf); 2375 seq_puts(m, buf);
@@ -2614,7 +2614,7 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys)
2614 2614
2615 /* Create the cgroup directory, which also creates the cgroup */ 2615 /* Create the cgroup directory, which also creates the cgroup */
2616 ret = vfs_mkdir(inode, dentry, S_IFDIR | 0755); 2616 ret = vfs_mkdir(inode, dentry, S_IFDIR | 0755);
2617 child = __d_cont(dentry); 2617 child = __d_cgrp(dentry);
2618 dput(dentry); 2618 dput(dentry);
2619 if (ret) { 2619 if (ret) {
2620 printk(KERN_INFO 2620 printk(KERN_INFO
@@ -2671,7 +2671,7 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys)
2671} 2671}
2672 2672
2673/* 2673/*
2674 * See if "cont" is a descendant of the current task's cgroup in 2674 * See if "cgrp" is a descendant of the current task's cgroup in
2675 * the appropriate hierarchy 2675 * the appropriate hierarchy
2676 * 2676 *
2677 * If we are sending in dummytop, then presumably we are creating 2677 * If we are sending in dummytop, then presumably we are creating
@@ -2679,37 +2679,37 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys)
2679 * 2679 *
2680 * Called only by the ns (nsproxy) cgroup. 2680 * Called only by the ns (nsproxy) cgroup.
2681 */ 2681 */
2682int cgroup_is_descendant(const struct cgroup *cont) 2682int cgroup_is_descendant(const struct cgroup *cgrp)
2683{ 2683{
2684 int ret; 2684 int ret;
2685 struct cgroup *target; 2685 struct cgroup *target;
2686 int subsys_id; 2686 int subsys_id;
2687 2687
2688 if (cont == dummytop) 2688 if (cgrp == dummytop)
2689 return 1; 2689 return 1;
2690 2690
2691 get_first_subsys(cont, NULL, &subsys_id); 2691 get_first_subsys(cgrp, NULL, &subsys_id);
2692 target = task_cgroup(current, subsys_id); 2692 target = task_cgroup(current, subsys_id);
2693 while (cont != target && cont!= cont->top_cgroup) 2693 while (cgrp != target && cgrp!= cgrp->top_cgroup)
2694 cont = cont->parent; 2694 cgrp = cgrp->parent;
2695 ret = (cont == target); 2695 ret = (cgrp == target);
2696 return ret; 2696 return ret;
2697} 2697}
2698 2698
2699static void check_for_release(struct cgroup *cont) 2699static void check_for_release(struct cgroup *cgrp)
2700{ 2700{
2701 /* All of these checks rely on RCU to keep the cgroup 2701 /* All of these checks rely on RCU to keep the cgroup
2702 * structure alive */ 2702 * structure alive */
2703 if (cgroup_is_releasable(cont) && !atomic_read(&cont->count) 2703 if (cgroup_is_releasable(cgrp) && !atomic_read(&cgrp->count)
2704 && list_empty(&cont->children) && !cgroup_has_css_refs(cont)) { 2704 && list_empty(&cgrp->children) && !cgroup_has_css_refs(cgrp)) {
2705 /* Control Group is currently removeable. If it's not 2705 /* Control Group is currently removeable. If it's not
2706 * already queued for a userspace notification, queue 2706 * already queued for a userspace notification, queue
2707 * it now */ 2707 * it now */
2708 int need_schedule_work = 0; 2708 int need_schedule_work = 0;
2709 spin_lock(&release_list_lock); 2709 spin_lock(&release_list_lock);
2710 if (!cgroup_is_removed(cont) && 2710 if (!cgroup_is_removed(cgrp) &&
2711 list_empty(&cont->release_list)) { 2711 list_empty(&cgrp->release_list)) {
2712 list_add(&cont->release_list, &release_list); 2712 list_add(&cgrp->release_list, &release_list);
2713 need_schedule_work = 1; 2713 need_schedule_work = 1;
2714 } 2714 }
2715 spin_unlock(&release_list_lock); 2715 spin_unlock(&release_list_lock);
@@ -2720,11 +2720,11 @@ static void check_for_release(struct cgroup *cont)
2720 2720
2721void __css_put(struct cgroup_subsys_state *css) 2721void __css_put(struct cgroup_subsys_state *css)
2722{ 2722{
2723 struct cgroup *cont = css->cgroup; 2723 struct cgroup *cgrp = css->cgroup;
2724 rcu_read_lock(); 2724 rcu_read_lock();
2725 if (atomic_dec_and_test(&css->refcnt) && notify_on_release(cont)) { 2725 if (atomic_dec_and_test(&css->refcnt) && notify_on_release(cgrp)) {
2726 set_bit(CONT_RELEASABLE, &cont->flags); 2726 set_bit(CGRP_RELEASABLE, &cgrp->flags);
2727 check_for_release(cont); 2727 check_for_release(cgrp);
2728 } 2728 }
2729 rcu_read_unlock(); 2729 rcu_read_unlock();
2730} 2730}
@@ -2763,10 +2763,10 @@ static void cgroup_release_agent(struct work_struct *work)
2763 char *argv[3], *envp[3]; 2763 char *argv[3], *envp[3];
2764 int i; 2764 int i;
2765 char *pathbuf; 2765 char *pathbuf;
2766 struct cgroup *cont = list_entry(release_list.next, 2766 struct cgroup *cgrp = list_entry(release_list.next,
2767 struct cgroup, 2767 struct cgroup,
2768 release_list); 2768 release_list);
2769 list_del_init(&cont->release_list); 2769 list_del_init(&cgrp->release_list);
2770 spin_unlock(&release_list_lock); 2770 spin_unlock(&release_list_lock);
2771 pathbuf = kmalloc(PAGE_SIZE, GFP_KERNEL); 2771 pathbuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
2772 if (!pathbuf) { 2772 if (!pathbuf) {
@@ -2774,14 +2774,14 @@ static void cgroup_release_agent(struct work_struct *work)
2774 continue; 2774 continue;
2775 } 2775 }
2776 2776
2777 if (cgroup_path(cont, pathbuf, PAGE_SIZE) < 0) { 2777 if (cgroup_path(cgrp, pathbuf, PAGE_SIZE) < 0) {
2778 kfree(pathbuf); 2778 kfree(pathbuf);
2779 spin_lock(&release_list_lock); 2779 spin_lock(&release_list_lock);
2780 continue; 2780 continue;
2781 } 2781 }
2782 2782
2783 i = 0; 2783 i = 0;
2784 argv[i++] = cont->root->release_agent_path; 2784 argv[i++] = cgrp->root->release_agent_path;
2785 argv[i++] = (char *)pathbuf; 2785 argv[i++] = (char *)pathbuf;
2786 argv[i] = NULL; 2786 argv[i] = NULL;
2787 2787