DragonFly commits List (threaded) for 2008-12
DragonFly-188.8.131.52.gb9eb1 master sys/kern lwkt_thread.c usched_bsd4.c sys/platform/pc32/i386 mplock.s trap.c sys/platform/vkernel/i386 mplock.s trap.c sys/sys thread.h
Author: Matthew Dillon <email@example.com>
Date: Thu Dec 18 13:37:37 2008 -0800
This is a MAJOR rewrite of usched_bsd4 and related support logic, plus
additional improvements to the LWKT scheduler.
* The LWKT scheduler used to run a user thread not needing the MP lock
if it was unable to run a kernel thread that did need it, due to some
other cpu holding the lock. This created a massive priority inversion
LWKT no longer does this. It will happily run other MPSAFE kernel
threads but as long as kernel threads exist which need the MP lock
LWKT will no longer switch to a user mode thread.
Add a new sysctl lwkt.chain_mplock which defaults to 0 (off). If set
to 1 LWKT will attempt to use IPIs to notify conflicting cpus when the
MP lock is available and will also allow user mode threads to run if
kernel threads are present needing the MP lock (but unable to get it).
NOTE: Current turning on this feature results in reduced performance,
though not as bad as pre-patch.
* The main control logic USCHED_BSD4 was almost completely rewritten,
greatly improving interactivity in the face of cpu bound programs
such as compiles.
USCHED_BSD4 no longer needs to use the scheduler helper when the
system is under load. The scheduler helper is only used to allow
one cpu to kick another idle cpu when additional processes are
USCHED_BSD4 now takes great advantage of the scheduler's cpu-local
design and uses a bidding algorithm for processes trying to return
to user mode to determine which one is the best. Winners simply
deschedule losers, and since the loser is clearly not running when
the winner does this the descheduling operation is ultra simple to
Summary of changes:
sys/kern/lwkt_thread.c | 120 ++++++++++++---
sys/kern/usched_bsd4.c | 311 +++++++++++++++++-------------------
sys/platform/pc32/i386/mplock.s | 4 +
sys/platform/pc32/i386/trap.c | 57 ++-----
sys/platform/vkernel/i386/mplock.s | 4 +
sys/platform/vkernel/i386/trap.c | 50 ++----
sys/sys/thread.h | 2 +
7 files changed, 288 insertions(+), 260 deletions(-)
DragonFly BSD source repository