Lmbench scheduler in lmbench-3.0-a7 is useful to get stable, reproducible results in SMP. But it was detected (see http://marc.theaimsgroup.com/?l=linux-kernel&m=116304920822136&w=2\) that fork() latency reported by lmbench is much higher than real latency of fork()+sched_setaffinity(). It is because of a lot of unneeded functions is called in interval of time which was measured as a fork() function latency. The functions which could be moved out of time interval been measured are: getenv(), sysconf(), strcasecmp() (7 calls), malloc(), realloc() (in a loop) and sched_getaffinity().
Lmbench is able to measure latency for Linux, Solaris, HPUX, IRIX, AIX but for Linux 35 lines are added in interval been measured including calls to malloc() twice, sched_getaffinity() and realloc() calls in a loop. As a result lmbench reports latency value 410 microseconds while correct latency 138 microseconds.
The patch for issue foxing is attached.
Leonid
patch_scheduler