linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Hillf Danton <dhillf@gmail.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	efault@gmx.de, peterz@infradead.org, dhillf@gmail.com,
	tglx@linutronix.de, yong.zhang0@gmail.com, mingo@elte.hu
Subject: [tip:sched/core] sched: Shorten the construction of the span cpu mask of sched domain
Date: Fri, 6 May 2011 07:40:26 GMT	[thread overview]
Message-ID: <tip-7142d17e8f935fa842e9f6eece2281b6d41625d6@git.kernel.org> (raw)
In-Reply-To: <BANLkTi=qPWxRAa6+dT3ohEP6Z=0v+e4EXA@mail.gmail.com>

Commit-ID:  7142d17e8f935fa842e9f6eece2281b6d41625d6
Gitweb:     http://git.kernel.org/tip/7142d17e8f935fa842e9f6eece2281b6d41625d6
Author:     Hillf Danton <dhillf@gmail.com>
AuthorDate: Thu, 5 May 2011 20:53:20 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 6 May 2011 09:13:05 +0200

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>
---
 kernel/sched.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 3d8a1b2..da93381 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -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;
 
@@ -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;
 }
 
@@ -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));
 	}
 }

  parent reply	other threads:[~2011-05-06  7:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05 12:53 [PATCH] sched: fix constructing the span cpu mask of sched domain Hillf Danton
2011-05-06  7:12 ` Ingo Molnar
2011-05-06  7:40 ` tip-bot for Hillf Danton [this message]
2011-05-10  8:32 ` Peter Zijlstra
2011-05-10 12:29   ` Hillf Danton
2011-05-11 13:26   ` Hillf Danton
2011-05-11 13:54     ` Peter Zijlstra
2011-05-11 14:10       ` Hillf Danton
2011-05-11 14:15         ` Ingo Molnar
2011-05-11 14:23           ` Hillf Danton
2011-05-13 13:06       ` Hillf Danton
2011-05-15  5:50       ` Hillf Danton
2011-05-17  9:23         ` Andreas Herrmann
2011-05-17 14:36           ` Hillf Danton
2011-05-18  2:45             ` Yong Zhang
2011-05-18 15:12               ` Hillf Danton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-7142d17e8f935fa842e9f6eece2281b6d41625d6@git.kernel.org \
    --to=dhillf@gmail.com \
    --cc=efault@gmx.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=yong.zhang0@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).