Move fork_rfppwait() check into ast()

This will always sleep at least once, so it's a slow path by definition.

Reviewed By:	kib
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D33387
This commit is contained in:
Edward Tomasz Napierala 2021-12-26 17:22:16 +00:00
parent 8cfd7a6aeb
commit 626d6992ca
3 changed files with 8 additions and 3 deletions

View File

@ -484,6 +484,12 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread *
*/
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) != 0)
td->td_flags |= TDF_ASTPENDING;
thread_unlock(td);
/*

View File

@ -285,7 +285,4 @@ syscallret(struct thread *td)
td->td_dbgflags &= ~(TDB_SCX | TDB_EXEC | TDB_FORK);
PROC_UNLOCK(p);
}
if (__predict_false(td->td_pflags & TDP_RFPPWAIT))
fork_rfppwait(td);
}

View File

@ -259,6 +259,8 @@ ast(struct trapframe *framep)
if (PMC_IS_PENDING_CALLCHAIN(td))
PMC_CALL_HOOK_UNLOCKED(td, PMC_FN_USER_CALLCHAIN_SOFT, (void *) framep);
#endif
if ((td->td_pflags & TDP_RFPPWAIT) != 0)
fork_rfppwait(td);
if (flags & TDF_ALRMPEND) {
PROC_LOCK(p);
kern_psignal(p, SIGVTALRM);