Subject: Re: halving context switch time
To: Chuck Silvers <chuq@chuq.com>
From: David Laight <david@l8s.co.uk>
List: port-i386
Date: 09/02/2002 09:09:28
On Sun, Sep 01, 2002 at 10:24:14PM -0700, Chuck Silvers wrote:
> hi,
> 
> this seems like a fine idea, however I agree with others
> that putting a counter in cpu_switch() wouldn't be the best way
> to go about it.  personally I think using the return value from
> cpu_switch() would be the best, but the per-cpu flag to indicate
> that we didn't sleep would also work.

Indeed, I just wanted something that would work and wouldn't
require a complete rewrite.
(Actually I even barfed at the register tracking/reassignment needed
to get the 'has idled' flag through the current i386 implementation.)

> to allow giving cpu_switch() a return value without needing to
> change all the instances at once, we could just conditionalize
> that part of mi_switch() on __HAVE_CPU_SWITCH_RETVAL or something
> like that, so we can convert each instance of cpu_switch()
> independently.  as for the SA code also adding a return value
> to cpu_switch(), we could just have it return two bits, one bit
> for if the current process is the same as the last process,
> and a different bit for whether or not cpu_switch() slept.

I think this can be done without requiring an incompatible change
to the interface to mi_switch - and hence without requiring all
the ports be changed at once.

I think the only call to cpu_switch is from mi_switch, as such
its current return value (the proc pointer) is never actually
used.  This means that the botton 2 bits of the return value
are currently always zero.
So if bit 0 is set if it is known to be the same process,
and bit 1 set if it is known not to have idled (or v.v.) then
nothing needs to be changed in the MD code (assuming it is
only an optimisation in the MI code).


	David

-- 
David Laight: david@l8s.co.uk