svn commit: r254167 - in head/sys: kern sys

Olivier Houchard cognet at FreeBSD.org
Fri Aug 9 23:13:54 UTC 2013


Author: cognet
Date: Fri Aug  9 23:13:52 2013
New Revision: 254167
URL: http://svnweb.freebsd.org/changeset/base/254167

Log:
  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.

Modified:
  head/sys/kern/init_main.c
  head/sys/kern/kern_synch.c
  head/sys/sys/proc.h

Modified: head/sys/kern/init_main.c
==============================================================================
--- head/sys/kern/init_main.c	Fri Aug  9 22:30:54 2013	(r254166)
+++ head/sys/kern/init_main.c	Fri Aug  9 23:13:52 2013	(r254167)
@@ -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).

Modified: head/sys/kern/kern_synch.c
==============================================================================
--- head/sys/kern/kern_synch.c	Fri Aug  9 22:30:54 2013	(r254166)
+++ head/sys/kern/kern_synch.c	Fri Aug  9 23:13:52 2013	(r254167)
@@ -121,8 +121,8 @@ SDT_PROBE_DEFINE(sched, , , schedctl_nop
 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

Modified: head/sys/sys/proc.h
==============================================================================
--- head/sys/sys/proc.h	Fri Aug  9 22:30:54 2013	(r254166)
+++ head/sys/sys/proc.h	Fri Aug  9 23:13:52 2013	(r254167)
@@ -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);


More information about the svn-src-all mailing list