OpenVZ Forum


Home » Mailing lists » Devel » [PATCH] Control groups: Replace "cont" with "cgrp" and other misc renaming
[PATCH] Control groups: Replace "cont" with "cgrp" and other misc renaming [message #21798] Tue, 16 October 2007 11:32 Go to previous message
Paul Menage is currently offline  Paul Menage
Messages: 642
Registered: September 2006
Senior Member
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>

---
 kernel/cgroup.c |  496 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 248 insertions(+), 248 deletions(-)

Index: container-2.6.23-mm1/kernel/cgroup.c
===================================================================
--- container-2.6.23-mm1.orig/kernel/cgroup.c
+++ container-2.6.23-mm1/kernel/cgroup.c
@@ -123,18 +123,18 @@ static int need_forkexit_callback;
 /* bits in struct cgroup flags field */
 enum {
 	/* Control Group is dead */
-	CONT_REMOVED,
+	CGRP_REMOVED,
 	/* Control Group has previously had a child cgroup or a task,
-	 * but no longer (only if CONT_NOTIFY_ON_RELEASE is set) */
-	CONT_RELEASABLE,
+	 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) */
+	CGRP_RELEASABLE,
 	/* Control Group requires release notifications to userspace */
-	CONT_NOTIFY_ON_RELEASE,
+	CGRP_NOTIFY_ON_RELEASE,
 };
 
 /* convenient tests for these bits */
-inline int cgroup_is_removed(const struct cgroup *cont)
+inline int cgroup_is_removed(const struct cgroup *cgrp)
 {
-	return test_bit(CONT_REMOVED, &cont->flags);
+	return test_bit(CGRP_REMOVED, &cgrp->flags);
 }
 
 /* bits in struct cgroupfs_root flags field */
@@ -142,17 +142,17 @@ enum {
 	ROOT_NOPREFIX, /* mounted subsystems have no named prefix */
 };
 
-inline int cgroup_is_releasable(const struct cgroup *cont)
+inline int cgroup_is_releasable(const struct cgroup *cgrp)
 {
 	const int bits =
-		(1 << CONT_RELEASABLE) |
-		(1 << CONT_NOTIFY_ON_RELEASE);
-	return (cont->flags & bits) == bits;
+		(1 << CGRP_RELEASABLE) |
+		(1 << CGRP_NOTIFY_ON_RELEASE);
+	return (cgrp->flags & bits) == bits;
 }
 
-inline int notify_on_release(const struct cgroup *cont)
+inline int notify_on_release(const struct cgroup *cgrp)
 {
-	return test_bit(CONT_NOTIFY_ON_RELEASE, &cont->flags);
+	return test_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
 }
 
 /*
@@ -172,7 +172,7 @@ static LIST_HEAD(release_list);
 static DEFINE_SPINLOCK(release_list_lock);
 static void cgroup_release_agent(struct work_struct *work);
 static DECLARE_WORK(release_agent_work, cgroup_release_agent);
-static void check_for_release(struct cgroup *cont);
+static void check_for_release(struct cgroup *cgrp);
 
 /* Link structure for associating css_set objects with cgroups */
 struct cg_cgroup_link {
@@ -180,7 +180,7 @@ struct cg_cgroup_link {
 	 * List running through cg_cgroup_links associated with a
 	 * cgroup, anchored on cgroup->css_sets
 	 */
-	struct list_head cont_link_list;
+	struct list_head cgrp_link_list;
 	/*
 	 * List running through cg_cgroup_links pointing at a
 	 * single css_set object, anchored on css_set->cg_links
@@ -238,7 +238,7 @@ static void unlink_css_set(struct css_se
 		link = list_entry(cg->cg_links.next,
 				  struct cg_cgroup_link, cg_link_list);
 		list_del(&link->cg_link_list);
-		list_del(&link->cont_link_list);
+		list_del(&link->cgrp_link_list);
 		kfree(link);
 	}
 	write_unlock(&css_set_lock);
@@ -253,12 +253,12 @@ static void __release_css_set(struct kre
 
 	rcu_read_lock();
 	for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
-		struct cgroup *cont = cg->subsys[i]->cgroup;
-		if (atomic_dec_and_test(&cont->count) &&
-		    notify_on_release(cont)) {
+		struct cgroup *cgrp = cg->subsys[i]->cgroup;
+		if (atomic_dec_and_test(&cgrp->count) &&
+		    notify_on_release(cgrp)) {
 			if (taskexit)
-				set_bit(CONT_RELEASABLE, &cont->flags);
-			check_for_release(cont);
+				set_bit(CGRP_RELEASABLE, &cgrp->flags);
+			check_for_release(cgrp);
 		}
 	}
 	rcu_read_unlock();
@@ -303,7 +303,7 @@ static inline void put_css_set_taskexit(
  * oldcg: the cgroup group that we're using before the cgroup
  * transition
  *
- * cont: the cgroup that we're moving into
+ * cgrp: the cgroup that we're moving into
  *
  * template: location in which to build the desired set of subsystem
  * state objects for the new cgroup group
@@ -311,11 +311,11 @@ static inline void put_css_set_taskexit(
 
 static struct css_set *find_existing_css_set(
 	struct css_set *oldcg,
-	struct cgroup *cont,
+	struct cgroup *cgrp,
 	struct cgroup_subsys_state *template[])
 {
 	int i;
-	struct cgroupfs_root *root = cont->root;
+	struct cgroupfs_root *root = cgrp->root;
 	struct list_head *l = &init_css_set.list;
 
 	/* Built the set of subsystem state objects that we want to
@@ -325,7 +325,7 @@ static struct css_set *find_existing_css
 			/* Subsystem is in this hierarchy. So we want
 			 * the subsystem state from the new
 			 * cgroup */
-			template[i] = cont->subsys[i];
+			template[i] = cgrp->subsys[i];
 		} else {
 			/* Subsystem is not in this hierarchy, so we
 			 * don't want to change the subsystem state */
@@ -352,7 +352,7 @@ static struct css_set *find_existing_css
 
 /*
  * allocate_cg_links() allocates "count" cg_cgroup_link structures
- * and chains them on tmp through their cont_link_list fields. Returns 0 on
+ * and chains them on tmp through their cgrp_link_list fields. Returns 0 on
  * success or a negative error
  */
 
@@ -367,13 +367,13 @@ static int allocate_cg_links(int count, 
 			while (!list_empty(tmp)) {
 				link = list_entry(tmp->next,
 						  struct cg_cgroup_link,
-						  cont_link_list);
-				list_del(&link->cont_link_list);
+						  cgrp_link_list);
+				list_del(&link->cgrp_link_list);
 				kfree(link);
 			}
 			return -ENOMEM;
 		}
-		list_add(&link->cont_link_list, tmp);
+		list_add(&link->cgrp_link_list, tmp);
 	}
 	return 0;
 }
@@ -384,8 +384,8 @@ static void free_cg_links(struct list_he
 		struct cg_cgroup_link *link;
 		link = list_entry(tmp->next,
 				  struct cg_cgroup_link,
-				  cont_link_list);
-		list_del(&link->cont_link_list);
+				  cgrp_link_list);
+		list_del(&link->cgrp_link_list);
 		kfree(link);
 	}
 }
@@ -399,7 +399,7 @@ static void free_cg_links(struct list_he
  */
 
 static struct css_set *find_css_set(
-	struct css_set *oldcg, struct cgroup *cont)
+	struct css_set *oldcg, struct cgroup *cgrp)
 {
 	struct css_set *res;
 	struct cgroup_subsys_state *template[CGROUP_SUBSYS_COUNT];
@@ -411,7 +411,7 @@ static struct css_set *find_css_set(
 	/* First see if we already have a cgroup group that matches
 	 * the desired set */
 	write_lock(&css_set_lock);
-	res = find_existing_css_set(oldcg, cont, template);
+	res = find_existing_css_set(oldcg, cgrp, template);
 	if (res)
 		get_css_set(res);
 	write_unlock(&css_set_lock);
@@ -440,9 +440,9 @@ static struct css_set *find_css_set(
 	write_lock(&css_set_lock);
 	/* Add reference counts and links from the new css_set. */
 	for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
-		struct cgroup *cont = res->subsys[i]->cgroup;
+		struct cgroup *cgrp = res->subsys[i]->cgroup;
 		struct cgroup_subsys *ss = subsys[i];
-		atomic_inc(&cont->count);
+		atomic_inc(&cgrp->count);
 		/*
 		 * We want to add a link once per cgroup, so we
 		 * only do it for the first subsystem in each
@@ -452,9 +452,9 @@ static struct css_set *find_css_set(
 			BUG_ON(list_empty(&tmp_cg_links));
 			link = list_entry(tmp_cg_links.next,
 					  struct cg_cgroup_link,
-					  cont_link_list);
-			list_del(&link->cont_link_list);
-			list_add(&link->cont_link_list, &cont->css_sets);
+					  cgrp_link_list);
+			list_del(&link->cgrp_link_list);
+			list_add(&link->cgrp_link_list, &cgrp->css_sets);
 			link->cg = res;
 			list_add(&link->cg_link_list, &res->cg_links);
 		}
@@ -462,9 +462,9 @@ static struct css_set *find_css_set(
 	if (list_empty(&rootnode.subsys_list)) {
 		link = list_entry(tmp_cg_links.next,
 				  struct cg_cgroup_link,
-				  cont_link_list);
-		list_del(&link->cont_link_list);
-		list_add(&link->cont_link_list, &dummytop->css_sets);
+				  cgrp_link_list);
+		list_del(&link->cgrp_link_list);
+		list_add(&link->cgrp_link_list, &dummytop->css_sets);
 		link->cg = res;
 		list_add(&link->cg_link_list, &res->cg_links);
 	}
@@ -564,7 +564,7 @@ void cgroup_unlock(void)
 
 static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode);
 static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry);
-static int cgroup_populate_dir(struct cgroup *cont);
+static int cgroup_populate_dir(struct cgroup *cgrp);
 static struct inode_operations cgroup_dir_inode_operations;
 static struct file_operations proc_cgroupstats_operations;
 
@@ -591,8 +591,8 @@ static void cgroup_diput(struct dentry *
 {
 	/* is dentry a directory ? if so, kfree() associated cgroup */
 	if (S_ISDIR(inode->i_mode)) {
-		struct cgroup *cont = dentry->d_fsdata;
-		BUG_ON(!(cgroup_is_removed(cont)));
+		struct cgroup *cgrp = dentry->d_fsdata;
+		BUG_ON(!(cgroup_is_removed(cgrp)));
 		/* It's possible for external users to be holding css
 		 * reference counts on a cgroup; css_put() needs to
 		 * be able to access the cgroup after decrementing
@@ -600,7 +600,7 @@ static void cgroup_diput(struct dentry *
 		 * queue the cgroup to be handled by the release
 		 * agent */
 		synchronize_rcu();
-		kfree(cont);
+		kfree(cgrp);
 	}
 	iput(inode);
 }
@@ -657,7 +657,7 @@ static int rebind_subsystems(struct cgro
 			      unsigned long final_bits)
 {
 	unsigned long added_bits, removed_bits;
-	struct cgroup *
...

 
Read Message
Read Message
Previous Topic: CONFIG_NAMESPACE* patchset
Next Topic: [BUGFIX][RFC][PATCH][only -mm] FIX memory leak in memory cgroup vs. page migration [0/1]
Goto Forum:
  


Current Time: Sat Sep 14 09:16:45 GMT 2024

Total time taken to generate the page: 0.04302 seconds