cvs commit: src/sys/conf options.i386 src/sys/i386/i386 machdep.c mp_machdep.c pmap.c swtch.s src/sys/i386/include md_var.h pmap.h smp.h src/sys/i386/isa apic_vector.s intr_machdep.h src/sys/kern kern_switch.c kern_synch.c kern_thr.c kern_thread.c subr_witness.c ...

Poul-Henning Kamp phk at phk.freebsd.dk
Wed Apr 2 22:34:24 PST 2003


In message <200304022353.h32NrUVZ042513 at repoman.freebsd.org>, Peter Wemm writes
:
>peter       2003/04/02 15:53:30 PST
>
>  FreeBSD src repository
>
>  Modified files:
>    sys/conf             options.i386 
>    sys/i386/i386        machdep.c mp_machdep.c pmap.c swtch.s 
>    sys/i386/include     md_var.h pmap.h smp.h 
>    sys/i386/isa         apic_vector.s intr_machdep.h 
>    sys/kern             kern_switch.c kern_synch.c kern_thr.c 
>                         kern_thread.c subr_witness.c 
>    sys/sparc64/sparc64  mp_machdep.c swtch.S 
>    sys/sys              proc.h 
>  Log:
>  Commit a partial lazy thread switch mechanism for i386.  it isn't as lazy
>  as it could be and can do with some more cleanup.  Currently its under
>  options LAZY_SWITCH.  What this does is avoid %cr3 reloads for short
>  context switches that do not involve another user process.

A naïve benchmark consisting of

	dd if=/dev/ad0 of=/dev/null count=200000

run five times on a disk-less Athlon 700 in singleuser mode from a
serial console indicates a pezzimization of about 2 microseconds
for each sector read:

With LAZY_SWITCH:
S+ N      5 Average:        0.000310656 Stddev:         0.000000443

Without LAZY_SWITCH:
S- N      5 Average:        0.000307986 Stddev:         0.000000618

Raw data:

# S/U + LAZY
echo -n "S+ "
echo '
102400000 bytes transferred in 61.990546 secs (1651865 bytes/sec)
102400000 bytes transferred in 62.175809 secs (1646943 bytes/sec)
102400000 bytes transferred in 62.144970 secs (1647760 bytes/sec)
102400000 bytes transferred in 62.117270 secs (1648495 bytes/sec)
102400000 bytes transferred in 62.227536 secs (1645574 bytes/sec)
' | awk 'NR > 0 && NF > 5 {print$5 / 200000.0}' | stddev

# S/U - LAZY
echo -n "S- "
echo '
102400000 bytes transferred in 61.495447 secs (1665164 bytes/sec)
102400000 bytes transferred in 61.732293 secs (1658775 bytes/sec)
102400000 bytes transferred in 61.688183 secs (1659961 bytes/sec)
102400000 bytes transferred in 61.444021 secs (1666558 bytes/sec)
102400000 bytes transferred in 61.626133 secs (1661633 bytes/sec)
' | awk 'NR > 0 && NF > 5 {print$5 / 200000.0}' | stddev

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the cvs-src mailing list