Subject: Re: halving context switch time
To: <>
From: David Laight <>
List: port-i386
Date: 08/22/2002 09:08:33
On Wed, Aug 21, 2002 at 09:00:04PM -0700, Bill Studenmund wrote:
> >
> > Ideally the return value of cpu_switch() [1] would need to be
> > changed to indicate whether it went into the idle loop or not.
> > Hovever I added a global 64-bit counter to the idle loop.
> > The following patch probably works (it isn't quite the one
> > I'm running):
> Why not just change cpu_switch to return if it entered or not? That seems
> to be the cleanest solution.

Cleanest yes, but I barfed at the relevant change to the asm
code.  There isn't a free register lurking to carry the info
across the 'process switch in' code.

An alternative would to be to call microtime() from inside
the idle loop code (ie when it exits).

One itsy problem is that the cpu_switch() function for every
port would need changing.....

Or put a flag into the per-cpu data that is on entry to
mi_switch and set if it went idle.  Actually inverting it
so that the flag is set on entry and cleared if idle would
allow mi_switch to work with an unmodified cpu_switch.
Just need to get access the the per-cpu data inside
the asm code.


David Laight: