Peter Williams wrote: > Peter Williams wrote: >> Siddha, Suresh B wrote: >>> more issues with smpnice patch... >>> >>> a) consider a 4-way system (simple SMP system with no HT and cores) >>> scenario >>> where a high priority task (nice -20) is running on P0 and two normal >>> priority tasks running on P1. load balance with smp nice code >>> will never be able to detect an imbalance and hence will never move >>> one of the normal priority tasks on P1 to idle cpus P2 or P3. >> >> Why? > > OK, I think I know why. The load balancing code will always decide that > P0 is the busiest CPU, right? Attached is a patch that addresses this problem. The strategies employed are: 1. for find_busiest_group() only consider groups that have at least one CPU with more than one task running as candidates for "busiest", and 2. for find_busiest_queue() only consider queues that have more than one running tasks as candidates for "busiest". I think that the overhead gains from earlier abandonment of load balancing attempts that would eventually (most probably -- see next paragraph) be abandoned anyway will compensate for the extra overhead introduced in these functions. I think that the only likely behavioural changes for an all tasks have nice==0 system is that without these checks there is a small chance that a "busiest" that only has one runnable task (and for which move_tasks() would eventually not move any tasks) when these tests are made may actually acquire extra runnable tasks before the locks are taken in preparation for calling move_tasks() and, therefore, load balancing may actually take place. I think that this effect can be safely ignored. Signed-off-by: Peter Williams Peter -- Peter Williams pwil3058@bigpond.net.au "Learning, n. The kind of ignorance distinguishing the studious." -- Ambrose Bierce