Re: anyone measured context-switch cost on Linux/ia32?

From: Artur Skawina (skawina@geocities.com)
Date: Fri Jan 21 2000 - 11:46:08 EST


Larry McVoy wrote:
>
> : here, on a celeron and a slightly hacked UP kernel, a context switch
> : (time between one process stops executing, is preempted, and another
> : starts running) is ~4800 cycles (10.7us) at best. stock kernels are
> : probably not much different in this area.
>
> lmbench, 2 process no working set case:
>
> 500Mhz Celeron, 2.2.14 Mandrake 7.0, 1.8usecs
> 400Mhz PPC (iMac), 2.2.14 Yellow dog 1.0(?), 1.4usecs
> 500Mhz Alpha, 2.2.13 Red hat 6.1, 2.3usecs

same celeron (450MHz, 2.3.40pre1as):
[17:00:52]# ./lat_ctx 2

"size=0k ovr=2.61
2 1.30
[17:00:53]#

> There's something wrong with either your benchmark or your system. 10usecs
> is more like Solaris :-)

we're measuring different things. i wanted to know various scheduling
/interrupt costs; the numbers are, as stated above, the (min) time
between the last timestamp in one process before it uses up its
timeslice and the first stamp in another process (both basically run
rdtsc in a loop). It does seem a bit high, yes. Will investigate later.
But these numbers clearly show that adding ~50 cycles to the context
switch path is not acceptable (0.1us may not sound much, but if
Mikael would add 50 cycles, i'd use 100 for sysenter, somebody else
took another 50 etc it would quickly add up).
[the most promising approach i can see right now would be two per
thread hooks for blocking/unbloking. If done right these would only
add two unconditional indirect jumps per ctx switch, and could
solve several problems]

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



This archive was generated by hypermail 2b29 : Sun Jan 23 2000 - 21:00:25 EST