public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "J.A. Magallon" <jamagallon@able.es>
To: Con Kolivas <kernel@kolivas.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	"Martin J. Bligh" <mbligh@mbligh.org>,
	Andrew Morton <akpm@osdl.org>,
	Christoph Lameter <clameter@engr.sgi.com>,
	Nick Piggin <piggin@cyberone.com.au>
Subject: Re: 2.6.12-rc6-mm1
Date: Fri, 10 Jun 2005 23:14:20 +0000	[thread overview]
Message-ID: <1118445260l.7785l.0l@werewolf.able.es> (raw)
In-Reply-To: 200506110019.13204.kernel@kolivas.org


On 06.10, Con Kolivas wrote:

> The priority biasing was off by mutliplying the total load by the total 
> priority bias and this ruins the ratio of loads between runqueues. This
> patch should correct the ratios of loads between runqueues to be proportional
> to overall load.
> 

2.6.12-rc6-mm1 + this patch just oopses nicely on boot.
I did not had a digital camera handy, but the first oops that fit in the
screen was this call chain:

kernel_thread_helper
init
init
do:base_setup
usermodehelper_init
__create_workqueue
EIP in try_to_wake_up

After this, there was another with some do_div_error calls...

Something looks un-initialized the first time, or the integer arithmetic
is wrong. I really dont like a*(b/c), I really prefer (a*b)/c. It is more
common b/c == 0 (because b<c), than the possibility of overflowing (a*b).

So I tried both. With this, it boots again:

--- linux-2.6.11-jam24/kernel/sched.c.orig	2005-06-11 00:59:44.000000000 +0200
+++ linux-2.6.11-jam24/kernel/sched.c	2005-06-11 01:03:32.000000000 +0200
@@ -987,9 +987,10 @@
 		 * prevent idle rebalance from trying to pull tasks from a
 		 * queue with only one running task.
 		 */
-		unsigned long prio_bias = rq->prio_bias / rq->nr_running;
+		unsigned long prio_scale = (rq->nr_running > 0 ? 
+										rq->nr_running : 1);
 
-		source_load *= prio_bias;
+		source_load = (source_load*rq->prio_bias) / prio_scale;
 	}
 
 	return source_load;
@@ -1015,9 +1016,10 @@
 		target_load = max(cpu_load, load_now);
 
 	if (idle == NOT_IDLE || rq->nr_running > 1) {
-		unsigned long prio_bias = rq->prio_bias / rq->nr_running;
+		unsigned long prio_scale = (rq->nr_running > 0 ? 
+										rq->nr_running : 1);
 
-		target_load *= prio_bias;
+		target_load = (target_load*rq->prio_bias) / prio_scale;
 	}
 
 	return target_load;


Perhaps this:

	if (idle == NOT_IDLE || rq->nr_running > 1)

should be

	if (idle == NOT_IDLE && rq->nr_running > 1)

???

Hope this helps, thanks.

> Signed-off-by: Con Kolivas <kernel@kolivas.org>
> 
> Index: linux-2.6.12-rc6-mm1/kernel/sched.c
> ===================================================================
> --- linux-2.6.12-rc6-mm1.orig/kernel/sched.c	2005-06-10 23:56:56.000000000 +1000
> +++ linux-2.6.12-rc6-mm1/kernel/sched.c	2005-06-10 23:59:57.000000000 +1000
> @@ -978,7 +978,7 @@ static inline unsigned long __source_loa
>  	else
>  		source_load = min(cpu_load, load_now);
>  
> -	if (idle == NOT_IDLE || rq->nr_running > 1)
> +	if (idle == NOT_IDLE || rq->nr_running > 1) {
>  		/*
>  		 * If we are busy rebalancing the load is biased by
>  		 * priority to create 'nice' support across cpus. When
> @@ -987,7 +987,10 @@ static inline unsigned long __source_loa
>  		 * prevent idle rebalance from trying to pull tasks from a
>  		 * queue with only one running task.
>  		 */
> -		source_load *= rq->prio_bias;
> +		unsigned long prio_bias = rq->prio_bias / rq->nr_running;
> +
> +		source_load *= prio_bias;
> +	}
>  
>  	return source_load;
>  }
> @@ -1011,8 +1014,11 @@ static inline unsigned long __target_loa
>  	else
>  		target_load = max(cpu_load, load_now);
>  
> -	if (idle == NOT_IDLE || rq->nr_running > 1)
> -		target_load *= rq->prio_bias;
> +	if (idle == NOT_IDLE || rq->nr_running > 1) {
> +		unsigned long prio_bias = rq->prio_bias / rq->nr_running;
> +
> +		target_load *= prio_bias;
> +	}
>  
>  	return target_load;
>  }
> 

--
J.A. Magallon <jamagallon()able!es>     \               Software is like sex:
werewolf!able!es                         \         It's better when it's free
Mandriva Linux release 2006.0 (Cooker) for i586
Linux 2.6.11-jam24 (gcc 4.0.0 (4.0.0-3mdk for Mandriva Linux release 2006.0))





  reply	other threads:[~2005-06-10 23:31 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-07 23:50 2.6.12-rc6-mm1 Martin J. Bligh
2005-06-07 23:56 ` 2.6.12-rc6-mm1 Andrew Morton
2005-06-08  0:02   ` 2.6.12-rc6-mm1 Christoph Lameter
2005-06-08  0:08     ` 2.6.12-rc6-mm1 Andrew Morton
2005-06-08  3:17       ` 2.6.12-rc6-mm1 Nick Piggin
2005-06-08  3:33         ` 2.6.12-rc6-mm1 Con Kolivas
2005-06-08  3:50           ` 2.6.12-rc6-mm1 Nick Piggin
2005-06-08 14:15       ` 2.6.12-rc6-mm1 Martin J. Bligh
2005-06-09 23:56       ` 2.6.12-rc6-mm1 Martin J. Bligh
2005-06-10  7:02         ` 2.6.12-rc6-mm1 Ingo Molnar
2005-06-10 12:03           ` 2.6.12-rc6-mm1 Con Kolivas
2005-06-10 14:19             ` 2.6.12-rc6-mm1 Con Kolivas
2005-06-10 23:14               ` J.A. Magallon [this message]
2005-06-10 23:59                 ` 2.6.12-rc6-mm1 Con Kolivas
2005-06-11  0:18                   ` 2.6.12-rc6-mm1 Con Kolivas
2005-06-11  0:32                   ` 2.6.12-rc6-mm1 J.A. Magallon
2005-06-11  0:48                     ` 2.6.12-rc6-mm1 Con Kolivas
2005-06-11  0:52                       ` 2.6.12-rc6-mm1 Con Kolivas
2005-06-10 23:50               ` 2.6.12-rc6-mm1 Martin J. Bligh
2005-06-11  4:14                 ` 2.6.12-rc6-mm1 Martin J. Bligh
2005-06-11  5:22                   ` 2.6.12-rc6-mm1 Con Kolivas
2005-06-11  5:56                     ` 2.6.12-rc6-mm1 Martin J. Bligh
2005-06-11 20:13                     ` 2.6.12-rc6-mm1 Martin J. Bligh
2005-06-11 22:20                       ` 2.6.12-rc6-mm1 Con Kolivas
2005-06-11 23:27                         ` 2.6.12-rc6-mm1 Martin J. Bligh
2005-06-11 23:47                           ` 2.6.12-rc6-mm1 Con Kolivas
2005-06-12  0:23                             ` 2.6.12-rc6-mm1 Martin J. Bligh
2005-06-12  5:19                               ` 2.6.12-rc6-mm1 Con Kolivas
2005-06-09  1:58     ` 2.6.12-rc6-mm1 Lee Revell
2005-06-08  0:02   ` 2.6.12-rc6-mm1 Martin J. Bligh
  -- strict thread matches above, loose matches on Subject: below --
2005-06-07 11:29 2.6.12-rc6-mm1 Andrew Morton
2005-06-07 14:24 ` 2.6.12-rc6-mm1 Wolfgang Wander
2005-06-07 14:49   ` 2.6.12-rc6-mm1 Wolfgang Wander
2005-06-07 14:48 ` 2.6.12-rc6-mm1 Brice Goglin
2005-06-07 23:15 ` 2.6.12-rc6-mm1 Francois Romieu
2005-06-08  1:59 ` 2.6.12-rc6-mm1 Søren Lott
2005-06-08  5:53   ` 2.6.12-rc6-mm1 Jean Delvare
2005-06-08  7:08     ` 2.6.12-rc6-mm1 Søren Lott
2005-06-08 14:22 ` 2.6.12-rc6-mm1 Andy Whitcroft
2005-06-08 20:01   ` 2.6.12-rc6-mm1 Andrew Morton
2005-06-08 23:14     ` 2.6.12-rc6-mm1 Martin J. Bligh
2005-06-08 23:22       ` 2.6.12-rc6-mm1 Andrew Morton
2005-06-08 23:34         ` 2.6.12-rc6-mm1 Martin J. Bligh
2005-06-09  7:17           ` 2.6.12-rc6-mm1 Kirill Korotaev
2005-06-09 13:38             ` 2.6.12-rc6-mm1 Martin J. Bligh
2005-06-10 12:12               ` 2.6.12-rc6-mm1 Kirill Korotaev
2005-06-09  4:27   ` 2.6.12-rc6-mm1 Andrey Panin
2005-06-09 13:12     ` 2.6.12-rc6-mm1 Andy Whitcroft
2005-06-11 11:51 ` 2.6.12-rc6-mm1 Benoit Boissinot
2005-06-18 22:39 ` 2.6.12-rc6-mm1 Richard Purdie
2005-06-18 22:44   ` 2.6.12-rc6-mm1 Andrew Morton
2005-06-18 22:57     ` 2.6.12-rc6-mm1 Richard Purdie
2005-06-18 23:11       ` 2.6.12-rc6-mm1 Richard Purdie
2005-06-18 23:18   ` 2.6.12-rc6-mm1 Russell King
2005-06-19  1:20     ` 2.6.12-rc6-mm1 Richard Purdie
2005-06-19  9:02       ` 2.6.12-rc6-mm1 Russell King
2005-06-19  9:11         ` 2.6.12-rc6-mm1 Russell King
2005-06-19 17:12           ` 2.6.12-rc6-mm1 Richard Purdie
2005-06-19 17:39             ` 2.6.12-rc6-mm1 Russell King
2005-06-19 18:25               ` 2.6.12-rc6-mm1 Richard Purdie
2005-06-19 18:56                 ` 2.6.12-rc6-mm1 Russell King
2005-06-21 13:20 ` 2.6.12-rc6-mm1 Dominik Karall
2005-06-24 21:27   ` 2.6.12-rc6-mm1 Alexey Dobriyan
2005-07-29  4:54   ` 2.6.12-rc6-mm1 Andrew Morton
2005-07-29 13:39     ` 2.6.12-rc6-mm1 Dominik Karall
2005-07-29 18:22       ` 2.6.12-rc6-mm1 Andrew Morton
2005-07-29 21:19         ` 2.6.12-rc6-mm1 Dominik Karall
2005-07-29 21:27           ` 2.6.12-rc6-mm1 Andrew Morton
2005-07-29 21:37             ` 2.6.12-rc6-mm1 Dominik Karall
2005-08-04 19:44               ` 2.6.12-rc6-mm1 Andrew Morton
2005-08-04 22:28                 ` 2.6.12-rc6-mm1 Andrew Morton
2005-08-04 22:44                   ` 2.6.12-rc6-mm1 Dominik Karall

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=1118445260l.7785l.0l@werewolf.able.es \
    --to=jamagallon@able.es \
    --cc=akpm@osdl.org \
    --cc=clameter@engr.sgi.com \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@mbligh.org \
    --cc=mingo@elte.hu \
    --cc=piggin@cyberone.com.au \
    /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