diff --git a/sys/kern/kern_fail.c b/sys/kern/kern_fail.c index b0a166d79e0d..ec466ddcb34d 100644 --- a/sys/kern/kern_fail.c +++ b/sys/kern/kern_fail.c @@ -52,6 +52,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_stack.h" + #include #include #include @@ -708,6 +710,7 @@ fail_point_get(struct fail_point *fp, struct sbuf *sb, fp_free(fp_entry_cpy); if (verbose) { +#ifdef STACK /* Print number of sleeping threads. queue=0 is the argument * used by msleep when sending our threads to sleep. */ sbuf_printf(sb, "\nsleeping_thread_stacks = {\n"); @@ -715,14 +718,17 @@ fail_point_get(struct fail_point *fp, struct sbuf *sb, &cnt_sleeping); sbuf_printf(sb, "},\n"); +#endif sbuf_printf(sb, "sleeping_thread_count = %d,\n", cnt_sleeping); +#ifdef STACK sbuf_printf(sb, "paused_thread_stacks = {\n"); sleepq_sbuf_print_stacks(sb, FP_PAUSE_CHANNEL(fp), 0, &cnt_sleeping); sbuf_printf(sb, "},\n"); +#endif sbuf_printf(sb, "paused_thread_count = %d\n", cnt_sleeping); } diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c index 2c68454be453..921e362a0939 100644 --- a/sys/kern/subr_sleepqueue.c +++ b/sys/kern/subr_sleepqueue.c @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include "opt_sleepqueue_profiling.h" #include "opt_ddb.h" #include "opt_sched.h" +#include "opt_stack.h" #include #include @@ -1042,6 +1043,7 @@ sleepq_abort(struct thread *td, int intrval) * printed. Typically, this will equal the number of threads sleeping on the * queue, but may be less if sb overflowed before all stacks were printed. */ +#ifdef STACK int sleepq_sbuf_print_stacks(struct sbuf *sb, void *wchan, int queue, int *count_stacks_printed) @@ -1149,6 +1151,7 @@ sleepq_sbuf_print_stacks(struct sbuf *sb, void *wchan, int queue, return (error); } +#endif #ifdef SLEEPQUEUE_PROFILING #define SLEEPQ_PROF_LOCATIONS 1024 diff --git a/sys/sys/sleepqueue.h b/sys/sys/sleepqueue.h index b607a5357e45..d59dc7e5a0a4 100644 --- a/sys/sys/sleepqueue.h +++ b/sys/sys/sleepqueue.h @@ -107,9 +107,11 @@ int sleepq_type(void *wchan); void sleepq_wait(void *wchan, int pri); int sleepq_wait_sig(void *wchan, int pri); -#include +#ifdef STACK +struct sbuf; int sleepq_sbuf_print_stacks(struct sbuf *sb, void *wchan, int queue, int *count_stacks_printed); +#endif #endif /* _KERNEL */ #endif /* !_SYS_SLEEPQUEUE_H_ */