pthread switch (was Odd KSE panic)
gallatin at cs.duke.edu
Tue Jul 6 08:51:39 PDT 2004
Daniel Eischen writes:
> With a small number of threads, it probably doesn't make sense
> to have more than one KSE (unless they are mostly CPU-bound).
> In Drew's example, there are 2 KSEs (HTT enabled) and only 2 threads.
Actually, there are 2 procs, each with 2 threads.
To elaborate, there are two processes, each running one instance of a
pingpong test for each of 2 NICs in the box.
> Each time a thread sleeps, the KSE enters the kernel to sleep
> (kse_release()) because there are no other threads to run.
> Drew, can you try lowering the concurrency? You can
> either try using pthread_setconcurrency(1) or setting
Here is the raw data for a ping-pong between 2 nics on the same box
with various configurations of cpu_idle_hlt and virtual_cpu.
Linux: kernel 2.66, Debian libc6 2.2.5-11.5 (no sysenter, or NPTL)
linulator: static binary used above, run under COMPAT_LINUX
thr: libthr (via libmap.conf)
BTW, there's a little more fat in the interrupt/wakeup path in the
FreeBSD MD driver code (condvars, MPSAFE intr, rather than an
INTR_FAST and some homebrew technique). Based on other measurements, I
don't think its 54us worth of fat (more like 15 or 20usec).
More information about the freebsd-threads