aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorHillf Danton <dhillf@gmail.com>2011-05-05 08:53:20 -0400
committerIngo Molnar <mingo@elte.hu>2011-05-06 03:13:05 -0400
commit7142d17e8f935fa842e9f6eece2281b6d41625d6 (patch)
treecf905dfa17b50e64d50f17cc5ea450117c91fad0 /kernel/sched.c
parent4934a4d3d3fa775601a9f1b35cc0e2aa93f81355 (diff)
sched: Shorten the construction of the span cpu mask of sched domain
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>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 3d8a1b2680ee..da9338150484 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6807,7 +6807,7 @@ __setup("isolcpus=", isolated_cpu_setup);
6807 */ 6807 */
6808static int find_next_best_node(int node, nodemask_t *used_nodes) 6808static int find_next_best_node(int node, nodemask_t *used_nodes)
6809{ 6809{
6810 int i, n, val, min_val, best_node = 0; 6810 int i, n, val, min_val, best_node = -1;
6811 6811
6812 min_val = INT_MAX; 6812 min_val = INT_MAX;
6813 6813
@@ -6831,7 +6831,8 @@ static int find_next_best_node(int node, nodemask_t *used_nodes)
6831 } 6831 }
6832 } 6832 }
6833 6833
6834 node_set(best_node, *used_nodes); 6834 if (best_node != -1)
6835 node_set(best_node, *used_nodes);
6835 return best_node; 6836 return best_node;
6836} 6837}
6837 6838
@@ -6857,7 +6858,8 @@ static void sched_domain_node_span(int node, struct cpumask *span)
6857 6858
6858 for (i = 1; i < SD_NODES_PER_DOMAIN; i++) { 6859 for (i = 1; i < SD_NODES_PER_DOMAIN; i++) {
6859 int next_node = find_next_best_node(node, &used_nodes); 6860 int next_node = find_next_best_node(node, &used_nodes);
6860 6861 if (next_node < 0)
6862 break;
6861 cpumask_or(span, span, cpumask_of_node(next_node)); 6863 cpumask_or(span, span, cpumask_of_node(next_node));
6862 } 6864 }
6863} 6865}