Re: [PATCH] Binding processes to selected CPUs

Rik van Riel (riel@nl.linux.org)
Sun, 3 Oct 1999 22:30:48 +0200 (CEST)


On Sun, 3 Oct 1999, Avi Kivity wrote:

> This patch, against 2.3.18ac8, allows a process to specify which
> CPUs it may execute on. It provides functionality similar to NT's
> ``thread affinity''.

OK. Apart from the fact whether we would want this piece of
code in the kernel (it's probably useful for some short-sliced
RT tasks), there's one big performance killer in your patch
that really should be removed...

In kernel/sched.c::goodness(), we see this code snippet:

> @@ -176,7 +194,16 @@
> weight = p->counter;
> +
> +#ifdef __SMP__
> + /* Bonus if switching from an unbindable cpu. Should happen */
> + /* at most once per rebinding. */
> + if (p->has_cpu && !bindable(p, p->processor))
> + weight += PROC_CHANGE_PENALTY;
> +#endif

You have to realize that goodness() is called for each process
on the runqueue for each reschedule. And this is only needed
once every rebind...

We should probably drop this piece of code in favor of a trick
done at rebinding (for example: just setting p->processor to a
wanted processor).

regards,

Rik

--
The Internet is not a network of computers. It is a network
of people. That is its real strength.
--
work at:	http://www.reseau.nl/
home at:	http://www.nl.linux.org/~riel/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/