public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched_best_cpu
@ 2003-08-13 13:00 Frank Cornelis
  2003-08-13 13:15 ` Frank Cornelis
  0 siblings, 1 reply; 2+ messages in thread
From: Frank Cornelis @ 2003-08-13 13:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: Frank Cornelis

Hi,

I ran across the '10 *' stuff (grrr... grrr...) in 
	linux-2.6.0-test3/kernel/sched.c:sched_best_cpu
I think next patch is more like it.


Frank.

--- sched.c.orig	2003-08-09 06:39:35.000000000 +0200
+++ sched.c	2003-08-13 14:55:05.000000000 +0200
@@ -776,7 +776,7 @@
  */
 static int sched_best_cpu(struct task_struct *p)
 {
-	int i, minload, load, best_cpu, node = 0;
+	int i, minload, load, best_cpu, node = 0, pnode;
 	unsigned long cpumask;
 
 	best_cpu = task_cpu(p);
@@ -784,14 +784,14 @@
 		return best_cpu;
 
 	minload = 10000000;
+	pnode = cpu_to_node(task_cpu(p));
 	for_each_node_with_cpus(i) {
 		/*
 		 * Node load is always divided by nr_cpus_node to normalise 
 		 * load values in case cpu count differs from node to node.
-		 * We first multiply node_nr_running by 10 to get a little
-		 * better resolution.   
+		 * If the node != our node we add the load of the task.
 		 */
-		load = 10 * atomic_read(&node_nr_running[i]) / nr_cpus_node(i);
+		load = (atomic_read(&node_nr_running[i]) + (i != pnode)) / nr_cpus_node(i);
 		if (load < minload) {
 			minload = load;
 			node = i;


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] sched_best_cpu
  2003-08-13 13:00 [PATCH] sched_best_cpu Frank Cornelis
@ 2003-08-13 13:15 ` Frank Cornelis
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Cornelis @ 2003-08-13 13:15 UTC (permalink / raw)
  To: Frank Cornelis; +Cc: linux-kernel

Ok, here's the good one.

Frank.


--- sched.c.orig	2003-08-09 06:39:35.000000000 +0200
+++ sched.c	2003-08-13 15:13:00.000000000 +0200
@@ -776,7 +776,7 @@
  */
 static int sched_best_cpu(struct task_struct *p)
 {
-	int i, minload, load, best_cpu, node = 0;
+	int i, minload, load, best_cpu, node = 0, pnode;
 	unsigned long cpumask;
 
 	best_cpu = task_cpu(p);
@@ -784,14 +784,15 @@
 		return best_cpu;
 
 	minload = 10000000;
+	pnode = cpu_to_node(task_cpu(p));
 	for_each_node_with_cpus(i) {
 		/*
 		 * Node load is always divided by nr_cpus_node to normalise 
 		 * load values in case cpu count differs from node to node.
-		 * We first multiply node_nr_running by 10 to get a little
-		 * better resolution.   
+		 * If the node != our node we add the load of the task.
+		 * We multiply by 10 for better resolution.
 		 */
-		load = 10 * atomic_read(&node_nr_running[i]) / nr_cpus_node(i);
+		load = 10 * (atomic_read(&node_nr_running[i]) + (i != pnode)) / nr_cpus_node(i);
 		if (load < minload) {
 			minload = load;
 			node = i;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-08-13 13:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-13 13:00 [PATCH] sched_best_cpu Frank Cornelis
2003-08-13 13:15 ` Frank Cornelis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox