DragonFly BSD
DragonFly commits List (threaded) for 2004-03
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

cvs commit: src/sys/kern lwkt_thread.c kern_switch.c src/sys/i386/i386 trap.c swtch.s

From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 28 Mar 2004 00:03:05 -0800 (PST)

dillon      2004/03/28 00:03:05 PST

DragonFly src repository

  Modified files:
    sys/kern             lwkt_thread.c kern_switch.c 
    sys/i386/i386        trap.c swtch.s 
  Do some major performance tuning of the userland scheduler.
  When determining whether to reschedule, use a relative priority comparison
  against PPQ rather then a queue index comparison to avoid the edge case
  where two processes are only a p_priority of 1 apart, but fall into
  different queues.  This reduces unnecessary preemptive context switches.
  Also change the sense of test_resched() and document it.
  Properly incriement p_ru.ru_nivcsw (involuntary context switches stat counter).
  Fix uio_yield().  We have to call lwkt_setpri_self() to cycle our thread
  to the end of its runq, and we do not need to call acquire_curproc() and
  release_curproc() after switching.
  When returning to userland, lower our priority and call lwkt_maybe_switch()
  BEFORE acquiring P_CURPROC.  Before we called lwkt_maybe_switch() after we
  acquired P_CURPROC which could result in us holding P_CURPROC, switching to
  another thread which itself returns to usermode at a higher priority, and
  that thread having to switch back to us to release P_CURPROC and then us back
  to the other thread again.  This reduces the number of unnecessary context
  switches that occur in certain situations.  In particular, this cuts the
  number of context switches in PIPE situations by 50-75% (1/2 to 2/3).
  Revision  Changes    Path
  1.57      +4 -0      src/sys/kern/lwkt_thread.c
  1.19      +28 -15    src/sys/kern/kern_switch.c
  1.47      +11 -3     src/sys/i386/i386/trap.c
  1.31      +1 -1      src/sys/i386/i386/swtch.s


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]