<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Nick Piggin &lt;piggin@cyberone.com.au&gt;

From: Frank Cornelis &lt;frank.cornelis@elis.ugent.be&gt;

In order to get the best possible resolution we need to use NR_CPUS instead
of the constant value 10.  load is an int, so no need to worry about
overflows...



---

 25-akpm/kernel/sched.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff -puN kernel/sched.c~sched-find_busiest_node-resolution-fix kernel/sched.c
--- 25/kernel/sched.c~sched-find_busiest_node-resolution-fix	2004-04-01 02:00:35.366731160 -0800
+++ 25-akpm/kernel/sched.c	2004-04-01 02:00:35.372730248 -0800
@@ -1104,7 +1104,7 @@ void sched_balance_exec(void)
  *      load_{t} = load_{t-1}/2 + nr_node_running_{t}
  * This way sudden load peaks are flattened out a bit.
  * Node load is divided by nr_cpus_node() in order to compare nodes
- * of different cpu count but also [first] multiplied by 10 to
+ * of different cpu count but also [first] multiplied by NR_CPUS to
  * provide better resolution.
  */
 static int find_busiest_node(int this_node)
@@ -1114,14 +1114,14 @@ static int find_busiest_node(int this_no
 	if (!nr_cpus_node(this_node))
 		return node;
 	this_load = maxload = (this_rq()-&gt;prev_node_load[this_node] &gt;&gt; 1)
-		+ (10 * atomic_read(&amp;node_nr_running[this_node])
+  + (NR_CPUS * atomic_read(&amp;node_nr_running[this_node])
 		/ nr_cpus_node(this_node));
 	this_rq()-&gt;prev_node_load[this_node] = this_load;
 	for_each_node_with_cpus(i) {
 		if (i == this_node)
 			continue;
 		load = (this_rq()-&gt;prev_node_load[i] &gt;&gt; 1)
-			+ (10 * atomic_read(&amp;node_nr_running[i])
+   + (NR_CPUS * atomic_read(&amp;node_nr_running[i])
 			/ nr_cpus_node(i));
 		this_rq()-&gt;prev_node_load[i] = load;
 		if (load &gt; maxload &amp;&amp; (100*load &gt; NODE_THRESHOLD*this_load)) {

_
</pre></body></html>