Re: Context switch times

george anzinger (george@mvista.com)
Sun, 07 Oct 2001 11:00:10 -0700


Mika Liljeberg wrote:
>
> Ingo Oeser wrote:
> > There are idle tasks per CPU. If there are runnable tasks and the
> > idle-task of a CPU is running it, it is not fully loaded at this
> > time.
> >
> > No idle task is running, if all CPUs are fully loaded AFAIR.
>
> Yes. However, you still want to balance the queues even if all CPUs are
> 100% utilized. It's a fairness issue. Otherwise you could have 1 task
> running on one CPU and 49 tasks on another.
>
On the face of it this only seems unfair. I think what we want to do is
to allocate the cpu resources among competing tasks as dictated by their
NICE values. If each task gets its allotted share it should not matter
if one of them is monopolizing one cpu. This is not to say that things
will work out this way, but to say that this is not the measure, nor the
thing to look at.

I suggest that, using the "recalculate tick" as a measure of time (I
know it is not very linear) when a cpu finds itself with nothing to do
(because all its tasks have completed their slices or blocked) and other
cpus have tasks in their queues it is time to "shop" for a new task to
run. This would then do load balancing just before each "recalculate
tick".

Of course, the above assumes that each cpu has its own run queue.

George
-
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/