diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2008-07-30 01:33:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-30 12:41:44 -0400 |
commit | 8d1e6266f512b3a94ef6d33528ff385f1aea0392 (patch) | |
tree | 92db3bfbd7bd667a98210a506aadb9db74e15fcd | |
parent | 4ef1b0fd61333b3b81ebe29283898c6c84b15c9f (diff) |
cpuset: a bit cleanup for scan_for_empty_cpusets()
clean up hierarchy traversal code
Signed-off-by: Li 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | kernel/cpuset.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 91cf85b36dd5..3624dc0e95ed 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -1833,24 +1833,21 @@ static void remove_tasks_in_empty_cpuset(struct cpuset *cs) | |||
1833 | */ | 1833 | */ |
1834 | static void scan_for_empty_cpusets(const struct cpuset *root) | 1834 | static void scan_for_empty_cpusets(const struct cpuset *root) |
1835 | { | 1835 | { |
1836 | LIST_HEAD(queue); | ||
1836 | struct cpuset *cp; /* scans cpusets being updated */ | 1837 | struct cpuset *cp; /* scans cpusets being updated */ |
1837 | struct cpuset *child; /* scans child cpusets of cp */ | 1838 | struct cpuset *child; /* scans child cpusets of cp */ |
1838 | struct list_head queue; | ||
1839 | struct cgroup *cont; | 1839 | struct cgroup *cont; |
1840 | nodemask_t oldmems; | 1840 | nodemask_t oldmems; |
1841 | 1841 | ||
1842 | INIT_LIST_HEAD(&queue); | ||
1843 | |||
1844 | list_add_tail((struct list_head *)&root->stack_list, &queue); | 1842 | list_add_tail((struct list_head *)&root->stack_list, &queue); |
1845 | 1843 | ||
1846 | while (!list_empty(&queue)) { | 1844 | while (!list_empty(&queue)) { |
1847 | cp = container_of(queue.next, struct cpuset, stack_list); | 1845 | cp = list_first_entry(&queue, struct cpuset, stack_list); |
1848 | list_del(queue.next); | 1846 | list_del(queue.next); |
1849 | list_for_each_entry(cont, &cp->css.cgroup->children, sibling) { | 1847 | list_for_each_entry(cont, &cp->css.cgroup->children, sibling) { |
1850 | child = cgroup_cs(cont); | 1848 | child = cgroup_cs(cont); |
1851 | list_add_tail(&child->stack_list, &queue); | 1849 | list_add_tail(&child->stack_list, &queue); |
1852 | } | 1850 | } |
1853 | cont = cp->css.cgroup; | ||
1854 | 1851 | ||
1855 | /* Continue past cpusets with all cpus, mems online */ | 1852 | /* Continue past cpusets with all cpus, mems online */ |
1856 | if (cpus_subset(cp->cpus_allowed, cpu_online_map) && | 1853 | if (cpus_subset(cp->cpus_allowed, cpu_online_map) && |