git: kernel - Add lock canceling features
Matthew Dillon
dillon at crater.dragonflybsd.org
Sat Nov 22 00:25:04 PST 2014
commit 4e3d9e11e7d9e81412b5db414ebe9054f555487d
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date: Sat Nov 22 00:10:19 2014 -0800
kernel - Add lock canceling features
* The current (typically exclusive) lock holder can enable cancel mode
by executing lockmgr(lk, LK_CANCEL_BEG, 0). This call always succeeds.
The lock state is not otherwise affected.
Any current threads blocked on the lock or any future thread which
attempts to gain the lock, who also specify the LK_CANCELABLE flag,
will be canceled as long as cancel mode is active and their operation
will return ENOLCK.
NOTE! Threads which do not specify LK_CANCELABLE are not affected by
cancel mode and their blocking locks will block normally.
WARNING! Cancel mode is not stackable. The system will panic if you
enable cancel mode on a lock where it is already enabled.
* The current (typically exclusive) lock holder can terminate cancel mode
by executing lockmgr(lk, LK_CANCEL_END, 0). This call always succeeds.
Once canceled, any other threads that would block on the lock and specify
the LK_CANCELABLE flag will block normally and not be canceled.
The current lock holder can also terminate cancel mode by simply releasing
the last lock with LK_RELEASE. That is, a release where the lock count
returns to 0.
* Lock canceling is an optional feature. Your lock cannot be canceled unless
you specify LK_CANCELABLE.
Summary of changes:
sys/kern/kern_lock.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++---
sys/kern/kern_sysctl.c | 2 +-
sys/sys/lock.h | 90 +++++++++++++++++++++++++------------
3 files changed, 175 insertions(+), 36 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/4e3d9e11e7d9e81412b5db414ebe9054f555487d
--
DragonFly BSD source repository
More information about the Commits
mailing list