cgroup: make cgroup_task_iter remember the cgroup being iterated
Currently all cgroup_task_iter functions require @cgrp to be passed in, which is superflous and increases chance of usage error. Make cgroup_task_iter remember the cgroup being iterated and drop @cgrp argument from next and end functions. 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: Matt Helsley <matthltc@us.ibm.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Balbir Singh <bsingharora@gmail.com>
This commit is contained in:
@@ -1804,7 +1804,7 @@ static void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
|
||||
struct task_struct *task;
|
||||
|
||||
cgroup_task_iter_start(cgroup, &it);
|
||||
while ((task = cgroup_task_iter_next(cgroup, &it))) {
|
||||
while ((task = cgroup_task_iter_next(&it))) {
|
||||
switch (oom_scan_process_thread(task, totalpages, NULL,
|
||||
false)) {
|
||||
case OOM_SCAN_SELECT:
|
||||
@@ -1817,7 +1817,7 @@ static void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
|
||||
case OOM_SCAN_CONTINUE:
|
||||
continue;
|
||||
case OOM_SCAN_ABORT:
|
||||
cgroup_task_iter_end(cgroup, &it);
|
||||
cgroup_task_iter_end(&it);
|
||||
mem_cgroup_iter_break(memcg, iter);
|
||||
if (chosen)
|
||||
put_task_struct(chosen);
|
||||
@@ -1834,7 +1834,7 @@ static void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
|
||||
get_task_struct(chosen);
|
||||
}
|
||||
}
|
||||
cgroup_task_iter_end(cgroup, &it);
|
||||
cgroup_task_iter_end(&it);
|
||||
}
|
||||
|
||||
if (!chosen)
|
||||
|
Reference in New Issue
Block a user