aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index d508cbf238c8..723fd62d2825 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -774,12 +774,16 @@ fork_exit(callout, arg, frame)
td->td_kse->ke_oncpu = PCPU_GET(cpuid);
/*
- * Setup the sched_lock state so that we can release it.
+ * Finish setting up thread glue. We need to initialize
+ * the thread into a td_critnest=1 state. Some platforms
+ * may have already partially or fully initialized td_critnest
+ * and/or td_md.md_savecrit (when applciable).
+ *
+ * see <arch>/<arch>/critical.c
*/
sched_lock.mtx_lock = (uintptr_t)td;
sched_lock.mtx_recurse = 0;
- td->td_critnest = 1;
- td->td_savecrit = CRITICAL_FORK;
+ cpu_critical_fork_exit();
CTR3(KTR_PROC, "fork_exit: new proc %p (pid %d, %s)", p, p->p_pid,
p->p_comm);
if (PCPU_GET(switchtime.sec) == 0)