amd64 cpu_switch in C.

Peter Wemm peter at wemm.org
Wed Mar 12 11:30:49 UTC 2008


On Wed, Mar 12, 2008 at 1:25 AM, Peter Wemm <peter at wemm.org> wrote:
> On Tue, Mar 11, 2008 at 9:14 PM, David Xu <davidxu at freebsd.org> wrote:
>  > Jeff Roberson wrote:
>  >  > http://people.freebsd.org/~jeff/amd64.diff
>  >
>  >  This is a good idea. In fact, according to calling conversion, some
>  >  registers are not needed to be saved across function call, e.g on
>  >  i386, eax, edx, and ecx. :-) but gdb may need them to dig out
>  >  stack variable's value.
>
>  Jeff and I have been having a friendly "competition" today.
>
>  With a UP kernel and INVARIANTS, my initial counter-patch response had
>  nearly double the gain on my machine.  (Jeff 7%, mine: 13.5%).
>  I changed to compile kernels the same as he did (no invariants, SMP
>  kernel, but kern.smp.disabled=1).  After that, our patch sets were the
>  same again - both at about 10% gain over baseline.
>
>  I've made a few more changes and am now at 23% improvement over baseline.
>
>  I'm not confident of testing methodology.  More tests are in progress.

I've found a couple of pthreads test cases where Jeff's version is a
couple of percent slower than the baseline, and mine is either the
same or a couple of percent faster.

His:
Difference at 95.0% confidence
        0.0921053 +/- 0.0648113
        2.6455% +/- 1.86155%
(2.6% longer to run the test)
Mine:
No difference proven at 95.0% confidence

Same test, different kernel options:
His:
No difference proven at 95.0% confidence
Mine:
Difference at 95.0% confidence
        -0.2055 +/- 0.204382
        -4.06086% +/- 4.03877%

But my favourite one is Jeff's preferred test configuration:
His:
Difference at 95.0% confidence
        -0.668 +/- 0.047188
        -10.9896% +/- 0.776309%
Mine:
Difference at 95.0% confidence
        -1.457 +/- 0.0290925
        -23.9697% +/- 0.478613%

(11% less time vs 24% less time for the test)

This stuff directly affects latency with ithreads, kthreads, task
queues, etc and should show up on networking benchmarks.

I'm moving over to testing in an otherwise virgin cvs tree, since my
p4 tree is somewhat polluted.  More numbers tomorrow.

-- 
Peter Wemm - peter at wemm.org; peter at FreeBSD.org; peter at yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5
"If Java had true garbage collection, most programs would delete
themselves upon execution." -- Robert Sewell


More information about the freebsd-arch mailing list