summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcognet <cognet@FreeBSD.org>2013-08-09 23:13:52 +0000
committercognet <cognet@FreeBSD.org>2013-08-09 23:13:52 +0000
commit333a884980fcd5ce0bb3149003f04f476f610185 (patch)
tree069d8482babd7b8421628739286b401d34278895
parent51c3f72bfa5a76f897b44233d886641ea448eb77 (diff)
downloadFreeBSD-src-333a884980fcd5ce0bb3149003f04f476f610185.zip
FreeBSD-src-333a884980fcd5ce0bb3149003f04f476f610185.tar.gz
Don't call sleepinit() from proc0_init(), make it a SYSINIT instead.
vmem needs the sleepq locks to be initialized when free'ing kva, so we want it called as early as possible.
-rw-r--r--sys/kern/init_main.c4
-rw-r--r--sys/kern/kern_synch.c10
-rw-r--r--sys/sys/proc.h1
3 files changed, 8 insertions, 7 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 247e431..40eff02 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -455,10 +455,6 @@ proc0_init(void *dummy __unused)
* Add scheduler specific parts to proc, thread as needed.
*/
schedinit(); /* scheduler gets its house in order */
- /*
- * Initialize sleep queue hash table
- */
- sleepinit();
/*
* Create process 0 (the swapper).
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index fb9c9bf..0996f4e 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -121,8 +121,8 @@ SDT_PROBE_DEFINE(sched, , , schedctl_nopreempt, schedctl-nopreempt);
SDT_PROBE_DEFINE(sched, , , schedctl_preempt, schedctl-preempt);
SDT_PROBE_DEFINE(sched, , , schedctl_yield, schedctl-yield);
-void
-sleepinit(void)
+static void
+sleepinit(void *unused)
{
hogticks = (hz / 10) * 2; /* Default only. */
@@ -130,6 +130,12 @@ sleepinit(void)
}
/*
+ * vmem tries to lock the sleepq mutexes when free'ing kva, so make sure
+ * it is available.
+ */
+SYSINIT(sleepinit, SI_SUB_KMEM, SI_ORDER_ANY, sleepinit, 0);
+
+/*
* General sleep call. Suspends the current thread until a wakeup is
* performed on the specified identifier. The thread will then be made
* runnable with the specified priority. Sleeps at most sbt units of time
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 0ef225a..2f03152 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -892,7 +892,6 @@ int setrunnable(struct thread *);
void setsugid(struct proc *p);
int should_yield(void);
int sigonstack(size_t sp);
-void sleepinit(void);
void stopevent(struct proc *, u_int, u_int);
struct thread *tdfind(lwpid_t, pid_t);
void threadinit(void);
OpenPOWER on IntegriCloud