aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpuset.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-08-08 20:11:26 -0400
committerTejun Heo <tj@kernel.org>2013-08-08 20:11:26 -0400
commit72ec7029937f0518eff21b8762743c31591684f5 (patch)
tree43743a5d9e6a36548a23d5ff34ffc4c4fede8aa1 /kernel/cpuset.c
parente535837b1dae17b5a2d76ea1bc22ac1a79354624 (diff)
cgroup: make task iterators deal with cgroup_subsys_state instead of cgroup
cgroup is in the process of converting to css (cgroup_subsys_state) from cgroup as the principal subsystem interface handle. This is mostly to prepare for the unified hierarchy support where css's will be created and destroyed dynamically but also helps cleaning up subsystem implementations as css is usually what they are interested in anyway. This patch converts task iterators to deal with css instead of cgroup. Note that under unified hierarchy, different sets of tasks will be considered belonging to a given cgroup depending on the subsystem in question and making the iterators deal with css instead cgroup provides them with enough information about the iteration. While at it, fix several function comment formats in cpuset.c. This patch doesn't introduce any behavior differences. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com> Acked-by: Michal Hocko <mhocko@suse.cz> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Balbir Singh <bsingharora@gmail.com> Cc: Matt Helsley <matthltc@us.ibm.com>
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r--kernel/cpuset.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 6fe23f2ac742..39e52175f4af 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -832,8 +832,8 @@ static struct cpuset *effective_nodemask_cpuset(struct cpuset *cs)
832 * @tsk: task to test 832 * @tsk: task to test
833 * @data: cpuset to @tsk belongs to 833 * @data: cpuset to @tsk belongs to
834 * 834 *
835 * Called by cgroup_scan_tasks() for each task in a cgroup whose 835 * Called by css_scan_tasks() for each task in a cgroup whose cpus_allowed
836 * cpus_allowed mask needs to be changed. 836 * mask needs to be changed.
837 * 837 *
838 * We don't need to re-check for the cgroup/cpuset membership, since we're 838 * We don't need to re-check for the cgroup/cpuset membership, since we're
839 * holding cpuset_mutex at this point. 839 * holding cpuset_mutex at this point.
@@ -849,27 +849,26 @@ static void cpuset_change_cpumask(struct task_struct *tsk, void *data)
849/** 849/**
850 * update_tasks_cpumask - Update the cpumasks of tasks in the cpuset. 850 * update_tasks_cpumask - Update the cpumasks of tasks in the cpuset.
851 * @cs: the cpuset in which each task's cpus_allowed mask needs to be changed 851 * @cs: the cpuset in which each task's cpus_allowed mask needs to be changed
852 * @heap: if NULL, defer allocating heap memory to cgroup_scan_tasks() 852 * @heap: if NULL, defer allocating heap memory to css_scan_tasks()
853 * 853 *
854 * Called with cpuset_mutex held 854 * Called with cpuset_mutex held
855 * 855 *
856 * The cgroup_scan_tasks() function will scan all the tasks in a cgroup, 856 * The css_scan_tasks() function will scan all the tasks in a cgroup,
857 * calling callback functions for each. 857 * calling callback functions for each.
858 * 858 *
859 * No return value. It's guaranteed that cgroup_scan_tasks() always returns 0 859 * No return value. It's guaranteed that css_scan_tasks() always returns 0
860 * if @heap != NULL. 860 * if @heap != NULL.
861 */ 861 */
862static void update_tasks_cpumask(struct cpuset *cs, struct ptr_heap *heap) 862static void update_tasks_cpumask(struct cpuset *cs, struct ptr_heap *heap)
863{ 863{
864 cgroup_scan_tasks(cs->css.cgroup, NULL, cpuset_change_cpumask, cs, 864 css_scan_tasks(&cs->css, NULL, cpuset_change_cpumask, cs, heap);
865 heap);
866} 865}
867 866
868/* 867/*
869 * update_tasks_cpumask_hier - Update the cpumasks of tasks in the hierarchy. 868 * update_tasks_cpumask_hier - Update the cpumasks of tasks in the hierarchy.
870 * @root_cs: the root cpuset of the hierarchy 869 * @root_cs: the root cpuset of the hierarchy
871 * @update_root: update root cpuset or not? 870 * @update_root: update root cpuset or not?
872 * @heap: the heap used by cgroup_scan_tasks() 871 * @heap: the heap used by css_scan_tasks()
873 * 872 *
874 * This will update cpumasks of tasks in @root_cs and all other empty cpusets 873 * This will update cpumasks of tasks in @root_cs and all other empty cpusets
875 * which take on cpumask of @root_cs. 874 * which take on cpumask of @root_cs.
@@ -1082,11 +1081,10 @@ static void *cpuset_being_rebound;
1082/** 1081/**
1083 * update_tasks_nodemask - Update the nodemasks of tasks in the cpuset. 1082 * update_tasks_nodemask - Update the nodemasks of tasks in the cpuset.
1084 * @cs: the cpuset in which each task's mems_allowed mask needs to be changed 1083 * @cs: the cpuset in which each task's mems_allowed mask needs to be changed
1085 * @heap: if NULL, defer allocating heap memory to cgroup_scan_tasks() 1084 * @heap: if NULL, defer allocating heap memory to css_scan_tasks()
1086 * 1085 *
1087 * Called with cpuset_mutex held 1086 * Called with cpuset_mutex held. No return value. It's guaranteed that
1088 * No return value. It's guaranteed that cgroup_scan_tasks() always returns 0 1087 * css_scan_tasks() always returns 0 if @heap != NULL.
1089 * if @heap != NULL.
1090 */ 1088 */
1091static void update_tasks_nodemask(struct cpuset *cs, struct ptr_heap *heap) 1089static void update_tasks_nodemask(struct cpuset *cs, struct ptr_heap *heap)
1092{ 1090{
@@ -1109,8 +1107,7 @@ static void update_tasks_nodemask(struct cpuset *cs, struct ptr_heap *heap)
1109 * It's ok if we rebind the same mm twice; mpol_rebind_mm() 1107 * It's ok if we rebind the same mm twice; mpol_rebind_mm()
1110 * is idempotent. Also migrate pages in each mm to new nodes. 1108 * is idempotent. Also migrate pages in each mm to new nodes.
1111 */ 1109 */
1112 cgroup_scan_tasks(cs->css.cgroup, NULL, cpuset_change_nodemask, &arg, 1110 css_scan_tasks(&cs->css, NULL, cpuset_change_nodemask, &arg, heap);
1113 heap);
1114 1111
1115 /* 1112 /*
1116 * All the tasks' nodemasks have been updated, update 1113 * All the tasks' nodemasks have been updated, update
@@ -1126,7 +1123,7 @@ static void update_tasks_nodemask(struct cpuset *cs, struct ptr_heap *heap)
1126 * update_tasks_nodemask_hier - Update the nodemasks of tasks in the hierarchy. 1123 * update_tasks_nodemask_hier - Update the nodemasks of tasks in the hierarchy.
1127 * @cs: the root cpuset of the hierarchy 1124 * @cs: the root cpuset of the hierarchy
1128 * @update_root: update the root cpuset or not? 1125 * @update_root: update the root cpuset or not?
1129 * @heap: the heap used by cgroup_scan_tasks() 1126 * @heap: the heap used by css_scan_tasks()
1130 * 1127 *
1131 * This will update nodemasks of tasks in @root_cs and all other empty cpusets 1128 * This will update nodemasks of tasks in @root_cs and all other empty cpusets
1132 * which take on nodemask of @root_cs. 1129 * which take on nodemask of @root_cs.
@@ -1254,12 +1251,12 @@ static int update_relax_domain_level(struct cpuset *cs, s64 val)
1254 return 0; 1251 return 0;
1255} 1252}
1256 1253
1257/* 1254/**
1258 * cpuset_change_flag - make a task's spread flags the same as its cpuset's 1255 * cpuset_change_flag - make a task's spread flags the same as its cpuset's
1259 * @tsk: task to be updated 1256 * @tsk: task to be updated
1260 * @data: cpuset to @tsk belongs to 1257 * @data: cpuset to @tsk belongs to
1261 * 1258 *
1262 * Called by cgroup_scan_tasks() for each task in a cgroup. 1259 * Called by css_scan_tasks() for each task in a cgroup.
1263 * 1260 *
1264 * We don't need to re-check for the cgroup/cpuset membership, since we're 1261 * We don't need to re-check for the cgroup/cpuset membership, since we're
1265 * holding cpuset_mutex at this point. 1262 * holding cpuset_mutex at this point.
@@ -1271,22 +1268,22 @@ static void cpuset_change_flag(struct task_struct *tsk, void *data)
1271 cpuset_update_task_spread_flag(cs, tsk); 1268 cpuset_update_task_spread_flag(cs, tsk);
1272} 1269}
1273 1270
1274/* 1271/**
1275 * update_tasks_flags - update the spread flags of tasks in the cpuset. 1272 * update_tasks_flags - update the spread flags of tasks in the cpuset.
1276 * @cs: the cpuset in which each task's spread flags needs to be changed 1273 * @cs: the cpuset in which each task's spread flags needs to be changed
1277 * @heap: if NULL, defer allocating heap memory to cgroup_scan_tasks() 1274 * @heap: if NULL, defer allocating heap memory to css_scan_tasks()
1278 * 1275 *
1279 * Called with cpuset_mutex held 1276 * Called with cpuset_mutex held
1280 * 1277 *
1281 * The cgroup_scan_tasks() function will scan all the tasks in a cgroup, 1278 * The css_scan_tasks() function will scan all the tasks in a cgroup,
1282 * calling callback functions for each. 1279 * calling callback functions for each.
1283 * 1280 *
1284 * No return value. It's guaranteed that cgroup_scan_tasks() always returns 0 1281 * No return value. It's guaranteed that css_scan_tasks() always returns 0
1285 * if @heap != NULL. 1282 * if @heap != NULL.
1286 */ 1283 */
1287static void update_tasks_flags(struct cpuset *cs, struct ptr_heap *heap) 1284static void update_tasks_flags(struct cpuset *cs, struct ptr_heap *heap)
1288{ 1285{
1289 cgroup_scan_tasks(cs->css.cgroup, NULL, cpuset_change_flag, cs, heap); 1286 css_scan_tasks(&cs->css, NULL, cpuset_change_flag, cs, heap);
1290} 1287}
1291 1288
1292/* 1289/*