Subject: Re: halving context switch time
To: David Laight <david@l8s.co.uk>
From: Bill Studenmund <wrstuden@netbsd.org>
List: port-i386
Date: 08/21/2002 21:00:04
On Thu, 15 Aug 2002, David Laight wrote:

> By far the largest contribution to the context switch time
> for netbsd i386 comes from the calls to microtime().
>
> Now if the kernel doesn't actually enter the idle loop, there
> is no reason not to use the same time for the end of one
> process and the start of another.  This cuts the context
> switch time by about 5us (6us with my faster microtime).
>
> 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.

Take care,

Bill