cvs commit: src/sys/i386/i386 genassym.c sys_machdep.c trap.c src/sys/i386/include cpu.h src/sys/i386/isa intr_machdep.c ipl.s src/sys/kern init_main.c kern_clock.c kern_exit.c kern_fork.c kern_switch.c kern_synch.c lwkt_thread.c sys_pipe.c src/sys/sys ...

Matthew Dillon dillon at
Tue Mar 30 11:14:49 PST 2004

dillon      2004/03/30 11:14:18 PST

DragonFly src repository

  Modified files:
    sys/i386/i386        genassym.c sys_machdep.c trap.c 
    sys/i386/include     cpu.h 
    sys/i386/isa         intr_machdep.c ipl.s 
    sys/kern             init_main.c kern_clock.c kern_exit.c 
                         kern_fork.c kern_switch.c kern_synch.c 
                         lwkt_thread.c sys_pipe.c 
    sys/sys              globaldata.h param.h proc.h thread.h 
    sys/amd64/amd64      genassym.c 
    sys/emulation/posix4 ksched.c 
  Second major scheduler patch.  This corrects interactive issues that were
  introduced in the pipe sf_buf patch.
  Split need_resched() into need_user_resched() and need_lwkt_resched().
  Userland reschedules are requested when a process is scheduled with a higher
  priority then the currently running process, and LWKT reschedules are
  requested when a thread is scheduled with a higher priority then the
  currently running thread.  As before, these are ASTs, LWKTs are not
  preemptively switch while running in the kernel.
  Exclusively use the resched wanted flags to determine whether to reschedule
  or call lwkt_switch() upon return to user mode.  We were previously also
  testing the LWKT run queue for higher priority threads, but this was causing
  inefficient scheduler interactions when two processes are doing tightly
  bound synchronous IPC (e.g. using PIPEs) because in DragonFly the LWKT
  priority of a thread is raised when it enters the kernel, and lowered when
  it tries to return to userland.  The wakeups occuring in the pipe code
  were causing extra quick-flip thread switches.
  Introduce a new tsleep() flag which disables the need_lwkt_resched() call
  when the sleeping thread is woken up.   This is used by the PIPE code in
  the synchronous direct-write PIPE case to avoid the above problem.
  Redocument and revamp the ESTCPU code.  The original changes reduced the
  interrupt rate from 100Hz (FBsd-4 and FBsd-5) to 20Hz, but did not compensate
  for the slower ramp-up time.  This commit introduces a 'virtual' ESTCPU
  frequency which compensates without us having to bump up the actual systimer
  interrupt rate.
  Redo the P_CURPROC methodology, which is used by the userland scheduler
  to manage processes running in userland.  Create a globaldata->gd_uschedcp
  process pointer which represents the current running-in-userland (or about
  to be running in userland) process, and carefully recode acquire_curproc()
  to allow this gd_uschedcp designation to be stolen from other threads trying
  to return to userland without having to request a reschedule (which would
  have to switch back to those threads to release the designation).  This
  reduces the number of unnecessary context switches that occur due to
  scheduler interactions.  Also note that this specifically solves the case
  where there might be several threads running in the kernel which are trying
  to return to userland at the same time.  A heuristic check against gd_upri
  is used to select the correct thread for schedling to userland 'most of the
  time'.  When the correct thread is not selected, we fall back to the old
  behavior of forcing a reschedule.
  Add debugging sysctl variables to better track userland scheduler efficiency.
  With these changes pipe statistics are further improved.  Though some
  scheduling aberrations still exist(1), the previous scheduler had totally
  broken interactive processes and this one does not.
  		MBytes/s	MBytes/s	MBytes/s	3200+ FN85MB
  							    (64KB L1, 1MB L2)
  	256KB	1900		2200		2250
  	 64KB	1800		2200		2250
  	 32KB	-		-		3300
  	 16KB	1650		2500-3000	2600-3200
  	  8KB	1400		2300		2000-2400(1)
  	  4KB	1300		1400-1500	1500-1700
  Revision  Changes    Path
  1.36      +2 -1      src/sys/i386/i386/genassym.c
  1.13      +1 -1      src/sys/i386/i386/sys_machdep.c
  1.48      +17 -78    src/sys/i386/i386/trap.c
  1.15      +14 -6     src/sys/i386/include/cpu.h
  1.21      +1 -1      src/sys/i386/isa/intr_machdep.c
  1.17      +1 -0      src/sys/i386/isa/ipl.s
  1.29      +3 -2      src/sys/kern/init_main.c
  1.18      +1 -1      src/sys/kern/kern_clock.c
  1.33      +2 -2      src/sys/kern/kern_exit.c
  1.21      +3 -3      src/sys/kern/kern_fork.c
  1.20      +240 -109  src/sys/kern/kern_switch.c
  1.31      +39 -39    src/sys/kern/kern_synch.c
  1.58      +36 -51    src/sys/kern/lwkt_thread.c
  1.16      +3 -3      src/sys/kern/sys_pipe.c
  1.29      +22 -15    src/sys/sys/globaldata.h
  1.13      +1 -0      src/sys/sys/param.h
  1.47      +10 -2     src/sys/sys/proc.h
  1.49      +1 -1      src/sys/sys/thread.h
  1.4       +2 -1      src/sys/amd64/amd64/genassym.c
  1.4       +5 -5      src/sys/emulation/posix4/ksched.c

More information about the Commits mailing list