Index: sys/kern/kern_fork.c =================================================================== --- sys/kern/kern_fork.c +++ sys/kern/kern_fork.c @@ -484,6 +484,12 @@ */ thread_lock(td); sched_fork(td, td2); + /* + * Request AST to check for TDP_RFPPWAIT. Do it here + * to avoid calling thread_lock() again. + */ + if (fr->fr_flags & RFPPWAIT) + td->td_flags |= TDF_ASTPENDING; thread_unlock(td); /* Index: sys/kern/subr_syscall.c =================================================================== --- sys/kern/subr_syscall.c +++ sys/kern/subr_syscall.c @@ -285,7 +285,4 @@ td->td_dbgflags &= ~(TDB_SCX | TDB_EXEC | TDB_FORK); PROC_UNLOCK(p); } - - if (__predict_false(td->td_pflags & TDP_RFPPWAIT)) - fork_rfppwait(td); } Index: sys/kern/subr_trap.c =================================================================== --- sys/kern/subr_trap.c +++ sys/kern/subr_trap.c @@ -259,6 +259,8 @@ if (PMC_IS_PENDING_CALLCHAIN(td)) PMC_CALL_HOOK_UNLOCKED(td, PMC_FN_USER_CALLCHAIN_SOFT, (void *) framep); #endif + if (__predict_false(td->td_pflags & TDP_RFPPWAIT)) + fork_rfppwait(td); if (flags & TDF_ALRMPEND) { PROC_LOCK(p); kern_psignal(p, SIGVTALRM);