cvs commit: src/sys/conf options.i386 src/sys/i386/i386machdep.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 ...

Nate Lawson nate at
Thu Apr 3 09:55:47 PST 2003

On Wed, 2 Apr 2003, Peter Wemm wrote:
> Nate Lawson wrote:
> > Shouldn't there be a "if (thread == curthread) return;" in the scheduling
> > code somewhere?
> There is now. :-)
>         newtd = choosethread();
>         if (td != newtd)
>                 cpu_switch(td, newtd);  /* SHAZAM!! */
>         else
>                 stupid_switch++;
> #endif
> sparc64's cpu_switch() already optimized this case.  i386 didn't.  I haven't
> checked alpha/ia64 yet, but they're still using the old no-args API.

The more things change...

"Probably 30% of the performance improvements came from fixing things in
the Sun kernel.  I mean like, really, guys:  If the current task doesn't
change, and it doesn't 80% of the time swtch is called, there's no need
to do a full context save and restore.  Adding the two lines

    cmpl    _masterprocp,a0
    jeq     6f               restore of current proc is easy

just before the call to "resume" in sun3/vax.s:swtch got me a quick 70
KB/s performance increase but felt more like a bug fix than progress."
   -- van


More information about the cvs-all mailing list