summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2016-12-31 17:05:09 +0000
committerjhb <jhb@FreeBSD.org>2016-12-31 17:05:09 +0000
commit4ccab6d42f7217249e615ba93e91a7449f015be9 (patch)
tree29b2cf44e7b139db1bb41fef87efd741e1a3fa55
parenta1a1877db83d7c5aa4ce309712bbc253b1802cff (diff)
downloadFreeBSD-src-4ccab6d42f7217249e615ba93e91a7449f015be9.zip
FreeBSD-src-4ccab6d42f7217249e615ba93e91a7449f015be9.tar.gz
MFC 310336:
Don't spin in pause() during early boot for kthreads other than thread0. pause() uses a spin loop to simulate a sleep during early boot. However, we only need this for thread0 to get far enough in the boot process to enable timers (at which point pause() can sleep). For other kthreads, sleeping in pause() is ok as the callout will be scheduled and will eventually fire once thread0 initializes timers.
-rw-r--r--sys/kern/kern_synch.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index f12b1d2..32a572b 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -321,7 +321,8 @@ pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags)
if (sbt == 0)
sbt = tick_sbt;
- if (cold || kdb_active || SCHEDULER_STOPPED()) {
+ if ((cold && curthread == &thread0) || kdb_active ||
+ SCHEDULER_STOPPED()) {
/*
* We delay one second at a time to avoid overflowing the
* system specific DELAY() function(s):
OpenPOWER on IntegriCloud