提交 8d1e6266 编写于 作者: L Li Zefan 提交者: Linus Torvalds

cpuset: a bit cleanup for scan_for_empty_cpusets()

clean up hierarchy traversal code
Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
Cc: Paul Menage <menage@google.com>
Cc: Cedric Le Goater <clg@fr.ibm.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Paul Jackson <pj@sgi.com>
Cc: Cliff Wickman <cpw@sgi.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 4ef1b0fd
...@@ -1833,24 +1833,21 @@ static void remove_tasks_in_empty_cpuset(struct cpuset *cs) ...@@ -1833,24 +1833,21 @@ static void remove_tasks_in_empty_cpuset(struct cpuset *cs)
*/ */
static void scan_for_empty_cpusets(const struct cpuset *root) static void scan_for_empty_cpusets(const struct cpuset *root)
{ {
LIST_HEAD(queue);
struct cpuset *cp; /* scans cpusets being updated */ struct cpuset *cp; /* scans cpusets being updated */
struct cpuset *child; /* scans child cpusets of cp */ struct cpuset *child; /* scans child cpusets of cp */
struct list_head queue;
struct cgroup *cont; struct cgroup *cont;
nodemask_t oldmems; nodemask_t oldmems;
INIT_LIST_HEAD(&queue);
list_add_tail((struct list_head *)&root->stack_list, &queue); list_add_tail((struct list_head *)&root->stack_list, &queue);
while (!list_empty(&queue)) { while (!list_empty(&queue)) {
cp = container_of(queue.next, struct cpuset, stack_list); cp = list_first_entry(&queue, struct cpuset, stack_list);
list_del(queue.next); list_del(queue.next);
list_for_each_entry(cont, &cp->css.cgroup->children, sibling) { list_for_each_entry(cont, &cp->css.cgroup->children, sibling) {
child = cgroup_cs(cont); child = cgroup_cs(cont);
list_add_tail(&child->stack_list, &queue); list_add_tail(&child->stack_list, &queue);
} }
cont = cp->css.cgroup;
/* Continue past cpusets with all cpus, mems online */ /* Continue past cpusets with all cpus, mems online */
if (cpus_subset(cp->cpus_allowed, cpu_online_map) && if (cpus_subset(cp->cpus_allowed, cpu_online_map) &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册