Skip to content

Commit

Permalink
cgroup: more naming cleanups
Browse files Browse the repository at this point in the history
Constantly use @cset for css_set variables and use @CGRP as cgroup
variables.

Signed-off-by: Li Zefan <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
  • Loading branch information
lizf-os authored and htejun committed Jul 31, 2013
1 parent e0798ce commit 6f4b7e6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions include/linux/cgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ struct cgroup_map_cb {

/* cftype->flags */
enum {
CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cg */
CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cg */
CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */
CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */
CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */
};

Expand Down Expand Up @@ -513,7 +513,7 @@ struct cftype_set {
};

struct cgroup_scanner {
struct cgroup *cg;
struct cgroup *cgrp;
int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan);
void (*process_task)(struct task_struct *p,
struct cgroup_scanner *scan);
Expand Down
26 changes: 13 additions & 13 deletions kernel/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ static inline void put_css_set_taskexit(struct css_set *cset)
* @new_cgrp: cgroup that's being entered by the task
* @template: desired set of css pointers in css_set (pre-calculated)
*
* Returns true if "cg" matches "old_cg" except for the hierarchy
* Returns true if "cset" matches "old_cset" except for the hierarchy
* which "new_cgrp" belongs to, for which it should match "new_cgrp".
*/
static bool compare_css_sets(struct css_set *cset,
Expand Down Expand Up @@ -1839,7 +1839,7 @@ EXPORT_SYMBOL_GPL(task_cgroup_path_from_hierarchy);
struct task_and_cgroup {
struct task_struct *task;
struct cgroup *cgrp;
struct css_set *cg;
struct css_set *cset;
};

struct cgroup_taskset {
Expand Down Expand Up @@ -2057,8 +2057,8 @@ static int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk,

tc = flex_array_get(group, i);
old_cset = task_css_set(tc->task);
tc->cg = find_css_set(old_cset, cgrp);
if (!tc->cg) {
tc->cset = find_css_set(old_cset, cgrp);
if (!tc->cset) {
retval = -ENOMEM;
goto out_put_css_set_refs;
}
Expand All @@ -2071,7 +2071,7 @@ static int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk,
*/
for (i = 0; i < group_size; i++) {
tc = flex_array_get(group, i);
cgroup_task_migrate(tc->cgrp, tc->task, tc->cg);
cgroup_task_migrate(tc->cgrp, tc->task, tc->cset);
}
/* nothing is sensitive to fork() after this point. */

Expand All @@ -2091,9 +2091,9 @@ static int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk,
if (retval) {
for (i = 0; i < group_size; i++) {
tc = flex_array_get(group, i);
if (!tc->cg)
if (!tc->cset)
break;
put_css_set(tc->cg);
put_css_set(tc->cset);
}
}
out_cancel_attach:
Expand Down Expand Up @@ -2203,9 +2203,9 @@ int cgroup_attach_task_all(struct task_struct *from, struct task_struct *tsk)

mutex_lock(&cgroup_mutex);
for_each_active_root(root) {
struct cgroup *from_cg = task_cgroup_from_root(from, root);
struct cgroup *from_cgrp = task_cgroup_from_root(from, root);

retval = cgroup_attach_task(from_cg, tsk, false);
retval = cgroup_attach_task(from_cgrp, tsk, false);
if (retval)
break;
}
Expand Down Expand Up @@ -3305,8 +3305,8 @@ int cgroup_scan_tasks(struct cgroup_scanner *scan)
* guarantees forward progress and that we don't miss any tasks.
*/
heap->size = 0;
cgroup_iter_start(scan->cg, &it);
while ((p = cgroup_iter_next(scan->cg, &it))) {
cgroup_iter_start(scan->cgrp, &it);
while ((p = cgroup_iter_next(scan->cgrp, &it))) {
/*
* Only affect tasks that qualify per the caller's callback,
* if he provided one
Expand Down Expand Up @@ -3339,7 +3339,7 @@ int cgroup_scan_tasks(struct cgroup_scanner *scan)
* the heap and wasn't inserted
*/
}
cgroup_iter_end(scan->cg, &it);
cgroup_iter_end(scan->cgrp, &it);

if (heap->size) {
for (i = 0; i < heap->size; i++) {
Expand Down Expand Up @@ -3385,7 +3385,7 @@ int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from)
{
struct cgroup_scanner scan;

scan.cg = from;
scan.cgrp = from;
scan.test_task = NULL; /* select all tasks in cgroup */
scan.process_task = cgroup_transfer_one_task;
scan.heap = NULL;
Expand Down
16 changes: 8 additions & 8 deletions kernel/cpuset.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ static void cpuset_change_cpumask(struct task_struct *tsk,
{
struct cpuset *cpus_cs;

cpus_cs = effective_cpumask_cpuset(cgroup_cs(scan->cg));
cpus_cs = effective_cpumask_cpuset(cgroup_cs(scan->cgrp));
set_cpus_allowed_ptr(tsk, cpus_cs->cpus_allowed);
}

Expand All @@ -866,7 +866,7 @@ static void update_tasks_cpumask(struct cpuset *cs, struct ptr_heap *heap)
{
struct cgroup_scanner scan;

scan.cg = cs->css.cgroup;
scan.cgrp = cs->css.cgroup;
scan.test_task = NULL;
scan.process_task = cpuset_change_cpumask;
scan.heap = heap;
Expand Down Expand Up @@ -1062,7 +1062,7 @@ static void cpuset_change_task_nodemask(struct task_struct *tsk,
static void cpuset_change_nodemask(struct task_struct *p,
struct cgroup_scanner *scan)
{
struct cpuset *cs = cgroup_cs(scan->cg);
struct cpuset *cs = cgroup_cs(scan->cgrp);
struct mm_struct *mm;
int migrate;
nodemask_t *newmems = scan->data;
Expand Down Expand Up @@ -1102,7 +1102,7 @@ static void update_tasks_nodemask(struct cpuset *cs, struct ptr_heap *heap)

guarantee_online_mems(mems_cs, &newmems);

scan.cg = cs->css.cgroup;
scan.cgrp = cs->css.cgroup;
scan.test_task = NULL;
scan.process_task = cpuset_change_nodemask;
scan.heap = heap;
Expand Down Expand Up @@ -1275,7 +1275,7 @@ static int update_relax_domain_level(struct cpuset *cs, s64 val)
static void cpuset_change_flag(struct task_struct *tsk,
struct cgroup_scanner *scan)
{
cpuset_update_task_spread_flag(cgroup_cs(scan->cg), tsk);
cpuset_update_task_spread_flag(cgroup_cs(scan->cgrp), tsk);
}

/*
Expand All @@ -1295,7 +1295,7 @@ static void update_tasks_flags(struct cpuset *cs, struct ptr_heap *heap)
{
struct cgroup_scanner scan;

scan.cg = cs->css.cgroup;
scan.cgrp = cs->css.cgroup;
scan.test_task = NULL;
scan.process_task = cpuset_change_flag;
scan.heap = heap;
Expand Down Expand Up @@ -1971,7 +1971,7 @@ static int cpuset_css_online(struct cgroup *cgrp)
struct cpuset *cs = cgroup_cs(cgrp);
struct cpuset *parent = parent_cs(cs);
struct cpuset *tmp_cs;
struct cgroup *pos_cg;
struct cgroup *pos_cgrp;

if (!parent)
return 0;
Expand Down Expand Up @@ -2003,7 +2003,7 @@ static int cpuset_css_online(struct cgroup *cgrp)
* (and likewise for mems) to the new cgroup.
*/
rcu_read_lock();
cpuset_for_each_child(tmp_cs, pos_cg, parent) {
cpuset_for_each_child(tmp_cs, pos_cgrp, parent) {
if (is_mem_exclusive(tmp_cs) || is_cpu_exclusive(tmp_cs)) {
rcu_read_unlock();
goto out_unlock;
Expand Down

0 comments on commit 6f4b7e6

Please sign in to comment.