Index: sys/sys/proc.h =================================================================== --- sys/sys/proc.h (revision 239118) +++ sys/sys/proc.h (working copy) @@ -969,6 +969,24 @@ curthread->td_pflags &= save; } +static __inline int +thread_nosleep_enter(void) +{ + int save; + + save = cuthread_pflags_set(curtrhread->td_pflags); + THREAD_NO_SLEEPING(); + return save; +} + +static __inline void +thread_nosleep_leave(int save) +{ + + THREAD_SLEEPING_OK(); + curthread_pflags_restore(save); +} + #endif /* _KERNEL */ #endif /* !_SYS_PROC_H_ */ Index: sys/kern/kern_timeout.c =================================================================== --- sys/kern/kern_timeout.c (revision 239119) +++ sys/kern/kern_timeout.c (working copy) @@ -638,7 +638,7 @@ void *c_arg; struct lock_class *class; struct lock_object *c_lock; - int c_flags, flags, sharedlock; + int c_flags, flags, sharedlock, thread_save; #ifdef SMP struct callout_cpu *new_cc; void (*new_func)(void *); @@ -704,13 +704,11 @@ #ifdef DIAGNOSTIC binuptime(&bt1); #endif - if (!direct) - THREAD_NO_SLEEPING(); + thread_save = thread_nosleep_enter(); SDT_PROBE(callout_execute, kernel, , callout_start, c, 0, 0, 0, 0); c_func(c_arg); SDT_PROBE(callout_execute, kernel, , callout_end, c, 0, 0, 0, 0); - if (!direct) - THREAD_SLEEPING_OK(); + thread_nosleep_leave(thread_save); #ifdef DIAGNOSTIC binuptime(&bt2); bintime_sub(&bt2, &bt1);