Skip to content

Commit

Permalink
sched: Shorten the construction of the span cpu mask of sched domain
Browse files Browse the repository at this point in the history
For a given node, when constructing the cpumask for its
sched_domain to span, if there is no best node available after
searching, further efforts could be saved, based on small change
in the return value of find_next_best_node().

Signed-off-by: Hillf Danton <dhillf@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Yong Zhang <yong.zhang0@gmail.com>
Link: http://lkml.kernel.org/r/BANLkTi%3DqPWxRAa6%2BdT3ohEP6Z%3D0v%2Be4EXA@mail.gmail.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Hillf Danton authored and Ingo Molnar committed May 6, 2011
1 parent 4934a4d commit 7142d17
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -6807,7 +6807,7 @@ __setup("isolcpus=", isolated_cpu_setup);
*/
static int find_next_best_node(int node, nodemask_t *used_nodes)
{
int i, n, val, min_val, best_node = 0;
int i, n, val, min_val, best_node = -1;

min_val = INT_MAX;

Expand All @@ -6831,7 +6831,8 @@ static int find_next_best_node(int node, nodemask_t *used_nodes)
}
}

node_set(best_node, *used_nodes);
if (best_node != -1)
node_set(best_node, *used_nodes);
return best_node;
}

Expand All @@ -6857,7 +6858,8 @@ static void sched_domain_node_span(int node, struct cpumask *span)

for (i = 1; i < SD_NODES_PER_DOMAIN; i++) {
int next_node = find_next_best_node(node, &used_nodes);

if (next_node < 0)
break;
cpumask_or(span, span, cpumask_of_node(next_node));
}
}
Expand Down

0 comments on commit 7142d17

Please sign in to comment.