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...

Peter Wemm peter at FreeBSD.org
Wed Apr 2 15:53:32 PST 2003


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.  ie: we can
  take an interrupt, switch to a kthread and return to the user without
  explicitly flushing the tlb.  However, this isn't as exciting as it could
  be, the interrupt overhead is still high and too much blocks on Giant
  still.  There are some debug sysctls, for stats and for an on/off switch.
  
  The main problem with doing this has been "what if the process that you're
  running on exits while we're borrowing its address space?" - in this case
  we use an IPI to give it a kick when we're about to reclaim the pmap.
  
  Its not compiled in unless you add the LAZY_SWITCH option.  I want to fix a
  few more things and get some more feedback before turning it on by default.
  
  This is NOT a replacement for Bosko's lazy interrupt stuff.  This was more
  meant for the kthread case, while his was for interrupts.  Mine helps a
  little for interrupts, but his helps a lot more.
  
  The stats are enabled with options SWTCH_OPTIM_STATS - this has been a
  pseudo-option for years, I just added a bunch of stuff to it.
  
  One non-trivial change was to select a new thread before calling
  cpu_switch() in the first place.  This allows us to catch the silly
  case of doing a cpu_switch() to the current process.  This happens
  uncomfortably often.  This simplifies a bit of the asm code in cpu_switch
  (no longer have to call choosethread() in the middle).  This has been
  implemented on i386 and (thanks to jake) sparc64.  The others will come
  soon.  This is actually seperate to the lazy switch stuff.
  
  Glanced at by:  jake, jhb
  
  Revision  Changes    Path
  1.188     +2 -0      src/sys/conf/options.i386
  1.561     +33 -3     src/sys/i386/i386/machdep.c
  1.207     +8 -1      src/sys/i386/i386/mp_machdep.c
  1.402     +128 -1    src/sys/i386/i386/pmap.c
  1.136     +112 -78   src/sys/i386/i386/swtch.s
  1.61      +16 -0     src/sys/i386/include/md_var.h
  1.94      +1 -1      src/sys/i386/include/pmap.h
  1.76      +1 -0      src/sys/i386/include/smp.h
  1.87      +22 -0     src/sys/i386/isa/apic_vector.s
  1.43      +5 -1      src/sys/i386/isa/intr_machdep.h
  1.57      +17 -1     src/sys/kern/kern_switch.c
  1.217     +23 -3     src/sys/kern/kern_synch.c
  1.3       +4 -0      src/sys/kern/kern_thr.c
  1.112     +6 -0      src/sys/kern/kern_thread.c
  1.150     +6 -0      src/sys/kern/subr_witness.c
  1.20      +1 -1      src/sys/sparc64/sparc64/mp_machdep.c
  1.26      +12 -14    src/sys/sparc64/sparc64/swtch.S
  1.311     +5 -0      src/sys/sys/proc.h


More information about the cvs-src mailing list