git: kernel - Introduce hard code sections, simplify critical sections & mplocks
Matthew Dillon
dillon at crater.dragonflybsd.org
Sat Aug 28 21:55:51 PDT 2010
commit 4a28fe22d241d9ebd6072389b0d87650b332b579
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date: Sat Aug 28 21:07:08 2010 -0700
kernel - Introduce hard code sections, simplify critical sections & mplocks
* Introduce hard code sections with crit_enter_hard(), crit_exit_hard(),
lwkt_gettoken_hard() and lwkt_reltoken_hard().
These functions create a hard code section that, like an interrupt or ipi,
does not allow any case which might potentially block or switch threads.
While in a hard code section any such case will assert and panic the
system.
For example, acquiring a token that is not already held would be disallowed
even if the acquisition could be accomplished without blocking. However,
acquiring a token which is already held would be allowed. Same with the
mplock, lockmgr locks, etc. (mtx's and serializers have not been dealt
with yet).
* Introduce ASSERT_LWKT_TOKEN_HARD() and ASSERT_LWKT_TOKEN_CRIT().
These assert that a token is held and a hard critical section (hard)
or any critical section (crit) is in place.
* Rework the critical section macros and optimize the crit_exit*() code
to two conditionals which are usually always false regardless of
whether critcount is transitioning 1->0 or not. Also declare
crit_panic() __dead2 which may produce better code.
* Rework get_mplock() to reduce code generation. The hard code section
assertions would have made it too big. We still optimize the case
where the mplock is already held.
Summary of changes:
sys/kern/kern_lock.c | 39 ++++-----------
sys/kern/kern_mplock.c | 22 ++++++++
sys/kern/lwkt_thread.c | 44 +++++++++++++----
sys/kern/lwkt_token.c | 47 +++++++++++++++---
sys/sys/globaldata.h | 2 +-
sys/sys/mplock2.h | 16 ++----
sys/sys/thread.h | 38 +++++++++++++-
sys/sys/thread2.h | 128 ++++++++++++++++++++++++-----------------------
sys/vm/vm_map.h | 3 +
9 files changed, 216 insertions(+), 123 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/4a28fe22d241d9ebd6072389b0d87650b332b579
--
DragonFly BSD source repository
More information about the Commits
mailing list