Messages in this thread Patch in this message | | | Date | Fri, 10 Jun 2005 23:14:20 +0000 | From | "J.A. Magallon" <> | Subject | Re: 2.6.12-rc6-mm1 |
| |
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))
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |