summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_turnstile.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2010-01-09 01:46:38 +0000
committerattilio <attilio@FreeBSD.org>2010-01-09 01:46:38 +0000
commitfde84f320b44c90f431d0a4145d7b83d2a221253 (patch)
treee46dd2a25d662a40bd7324ff4489431a2403931d /sys/kern/subr_turnstile.c
parentda19d81aaa4a2ec26f7ad15e4c609a36f868e9e0 (diff)
downloadFreeBSD-src-fde84f320b44c90f431d0a4145d7b83d2a221253.zip
FreeBSD-src-fde84f320b44c90f431d0a4145d7b83d2a221253.tar.gz
Introduce the new kernel thread called "deadlock resolver".
While the name is pretentious, a good explanation of its targets is reported in this 17 months old presentation e-mail: http://lists.freebsd.org/pipermail/freebsd-arch/2008-August/008452.html In order to implement it, the sq_type in sleepqueues is mandatory and not only compiled along with INVARIANTS option. Additively, a new sleepqueue function, sleepq_type() is added, returning the type of the sleepqueue linked to a wchan. Three new sysctls are added in order to configure the thread: debug.deadlkres.slptime_threshold debug.deadlkres.blktime_threshold debug.deadlkres.sleepfreq rappresenting the thresholds for sleep and block time that will lead to a deadlock matching (when exceeded), while the sleepfreq rappresents the number of seconds between 2 consecutive thread runnings. In order to enable the deadlock resolver thread recompile your kernel with the option DEADLKRES. Reviewed by: jeff Tested by: pho, Giovanni Trematerra Sponsored by: Nokia Incorporated, Sandvine Incorporated MFC after: 2 weeks
Diffstat (limited to 'sys/kern/subr_turnstile.c')
-rw-r--r--sys/kern/subr_turnstile.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/subr_turnstile.c b/sys/kern/subr_turnstile.c
index 2aad232..114b139 100644
--- a/sys/kern/subr_turnstile.c
+++ b/sys/kern/subr_turnstile.c
@@ -733,6 +733,7 @@ turnstile_wait(struct turnstile *ts, struct thread *owner, int queue)
td->td_tsqueue = queue;
td->td_blocked = ts;
td->td_lockname = lock->lo_name;
+ td->td_blktick = ticks;
TD_SET_LOCK(td);
mtx_unlock_spin(&tc->tc_lock);
propagate_priority(td);
@@ -925,6 +926,7 @@ turnstile_unpend(struct turnstile *ts, int owner_type)
MPASS(TD_CAN_RUN(td));
td->td_blocked = NULL;
td->td_lockname = NULL;
+ td->td_blktick = 0;
#ifdef INVARIANTS
td->td_tsqueue = 0xff;
#endif
OpenPOWER on IntegriCloud