Re: SMP Affinity and nice

From: Peter Williams
Date: Thu Aug 24 2006 - 01:22:32 EST


Chris Friesen wrote:
Rich Paredes wrote:

So since cpumax5 has a lower nice value and thus a higher priority (25 in
this case), shouldn't it be given it's own cpu. If I give cpumax5 a nice
value of -20, it does start using it's own cpu.

My explanation would be that since the scheduler tries to limit cpu
affinity, the nice value of 0 isn't enough to get the scheduler to move
this process to another processors run queue. I could be totally wrong
here though.

I think you are correct. The load balancer doesn't think that this is enough of an imbalance to go through the effort of swapping two processes around.

The kernel in use (2.6.5) doesn't take nice into account during load balancing and just allocates the 5 tasks among the 4 CPUs in a way that tries to give each CPU the same number of tasks. It also tries not to move tasks around too much so when it has found a solution that satisfies that criterion it leaves the tasks there.

5 tasks among 4 CPUs means 1 task each for 3 of the CPUs and 2 tasks for the other CPU. As nice isn't taken into account it is purely down to chance whether or not the high priority task ends up being one of those that gets a CPU to itself or has to share with another task. Some elementary probability theory should enable the probability of a "good" outcome (i.e. the high priority task not having to share) to be calculated.

This is an example of the type of situation that the smpnice patches were designed to handle. They take nice into account and should ensure that the high priority does get a CPU to itself in this scenario. They are scheduled for release in the 2.6.18 kernel.

Peter
--
Peter Williams pwil3058@xxxxxxxxxxxxxx

"Learning, n. The kind of ignorance distinguishing the studious."
-- Ambrose Bierce
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/