diff options
author | phk <phk@FreeBSD.org> | 2003-06-20 08:07:15 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-06-20 08:07:15 +0000 |
commit | 6689b404af0ff9a980306eadf2ce472509df3ee2 (patch) | |
tree | d6ebc1271edc0be89aba8c55e8dcb0b2d127eba3 /sys/kern/kern_timeout.c | |
parent | b64d71d8c882365e1edc1d44eb28353a342e59e1 (diff) | |
download | FreeBSD-src-6689b404af0ff9a980306eadf2ce472509df3ee2.zip FreeBSD-src-6689b404af0ff9a980306eadf2ce472509df3ee2.tar.gz |
Crude but efficient:
#ifdef DIAGNOSTIC hold a mutex while calling callout's so that we hear
about it if they sleep.
Diffstat (limited to 'sys/kern/kern_timeout.c')
-rw-r--r-- | sys/kern/kern_timeout.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index d789476..be13f97 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -69,7 +69,9 @@ struct callout_list callfree; int callwheelsize, callwheelbits, callwheelmask; struct callout_tailq *callwheel; int softticks; /* Like ticks, but for softclock(). */ -struct mtx callout_lock; +#ifdef DIAGNOSTIC +struct mtx callout_lock, callout_dont_sleep; +#endif static struct callout *nextsoftcheck; /* Next callout to be checked. */ @@ -120,6 +122,9 @@ kern_timeout_callwheel_init(void) TAILQ_INIT(&callwheel[i]); } mtx_init(&callout_lock, "callout", NULL, MTX_SPIN | MTX_RECURSE); +#ifdef DIAGNOSTIC + mtx_init(&callout_dont_sleep, "callout_dont_sleep", NULL, MTX_DEF); +#endif } /* @@ -214,9 +219,11 @@ softclock(void *dummy) } #ifdef DIAGNOSTIC binuptime(&bt1); + mtx_lock(&callout_dont_sleep); #endif c_func(c_arg); #ifdef DIAGNOSTIC + mtx_unlock(&callout_dont_sleep); binuptime(&bt2); bintime_sub(&bt2, &bt1); if (bt2.frac > maxdt) { |