Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318399
b: refs/heads/master
c: 80d1fa6
h: refs/heads/master
i:
  318397: 50fc4cc
  318395: f59c712
  318391: ab78aaa
  318383: 8494a5a
  318367: 3e7726c
  318335: d9de250
v: v3
  • Loading branch information
Srivatsa S. Bhat authored and Ingo Molnar committed Jul 24, 2012
1 parent e593674 commit cda03b6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d35be8bab9b0ce44bed4b9453f86ebf64062721e
refs/heads/master: 80d1fa6463d934969b7aebf04107fc133463f0f6
36 changes: 27 additions & 9 deletions trunk/kernel/cpuset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,32 @@ static void remove_tasks_in_empty_cpuset(struct cpuset *cs)
move_member_tasks_to_cpuset(cs, parent);
}

/*
* Helper function to traverse cpusets.
* It can be used to walk the cpuset tree from top to bottom, completing
* one layer before dropping down to the next (thus always processing a
* node before any of its children).
*/
static struct cpuset *cpuset_next(struct list_head *queue)
{
struct cpuset *cp;
struct cpuset *child; /* scans child cpusets of cp */
struct cgroup *cont;

if (list_empty(queue))
return NULL;

cp = list_first_entry(queue, struct cpuset, stack_list);
list_del(queue->next);
list_for_each_entry(cont, &cp->css.cgroup->children, sibling) {
child = cgroup_cs(cont);
list_add_tail(&child->stack_list, queue);
}

return cp;
}


/*
* Walk the specified cpuset subtree and look for empty cpusets.
* The tasks of such cpuset must be moved to a parent cpuset.
Expand All @@ -2008,19 +2034,11 @@ static void scan_for_empty_cpusets(struct cpuset *root)
{
LIST_HEAD(queue);
struct cpuset *cp; /* scans cpusets being updated */
struct cpuset *child; /* scans child cpusets of cp */
struct cgroup *cont;
static nodemask_t oldmems; /* protected by cgroup_mutex */

list_add_tail((struct list_head *)&root->stack_list, &queue);

while (!list_empty(&queue)) {
cp = list_first_entry(&queue, struct cpuset, stack_list);
list_del(queue.next);
list_for_each_entry(cont, &cp->css.cgroup->children, sibling) {
child = cgroup_cs(cont);
list_add_tail(&child->stack_list, &queue);
}
while ((cp = cpuset_next(&queue)) != NULL) {

/* Continue past cpusets with all cpus, mems online */
if (cpumask_subset(cp->cpus_allowed, cpu_active_mask) &&
Expand Down

0 comments on commit cda03b6

Please sign in to comment.