tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CPUs and processes not evenly assigned?!
On Thu, 10 Nov 2016, Michael van Elst wrote:
Can you try this?
Tried it, and it seems to help with both 2 and 4 CPUs.
Codebase: -current
Great, so the problem was just the rounding error.
Yes. I've also played with it a bit more, and the "stealing" of processes
between CPUs seems to get less with the factor of r_mcount, e.g. with 4*
below I see less movement of processes on a 4-CPU system as shown in the
patch below.
Maybe this should be made a sysctl or depend on the number of CPUs?
- Hubert
--- sys/kern/kern_runq.c.orig 2016-11-10 21:11:10.000000000 +0000
+++ sys/kern/kern_runq.c
@@ -534,7 +534,9 @@ sched_balance(void *nocallout)
ci_rq = ci->ci_schedstate.spc_sched_info;
/* Average count of the threads */
- ci_rq->r_avgcount = (ci_rq->r_avgcount + ci_rq->r_mcount) >> 1;
+ ci_rq->r_avgcount = (ci_rq->r_avgcount +
+ 4*ci_rq->r_mcount
+ ) /2;
/* Look for CPU with the highest average */
if (ci_rq->r_avgcount > highest) {
- Hubert
Home |
Main Index |
Thread Index |
Old Index