proc: postpone proc unlock until after reporting with kqueue

kqueue would always relock immediately afterwards.

While here drop the NULL check for list itself. The list is
always allocated.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mateusz Guzik 2018-12-08 06:34:12 +00:00
parent eadb1dcb71
commit e52327e3c5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=341722
2 changed files with 8 additions and 8 deletions

View File

@ -533,11 +533,12 @@ knote_fork(struct knlist *list, int pid)
struct kevent kev;
int error;
if (list == NULL)
MPASS(list != NULL);
KNL_ASSERT_LOCKED(list);
if (SLIST_EMPTY(&list->kl_list))
return;
memset(&kev, 0, sizeof(kev));
list->kl_lock(list->kl_lockarg);
SLIST_FOREACH(kn, &list->kl_list, kn_selnext) {
kq = kn->kn_kq;
KQ_LOCK(kq);
@ -606,7 +607,6 @@ knote_fork(struct knlist *list, int pid)
kn_leave_flux(kn);
KQ_UNLOCK_FLUX(kq);
}
list->kl_unlock(list->kl_lockarg);
}
/*

View File

@ -685,16 +685,16 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread *
}
PROC_UNLOCK(p2);
/*
* Tell any interested parties about the new process.
*/
knote_fork(p1->p_klist, p2->p_pid);
/*
* Now can be swapped.
*/
_PRELE(p1);
PROC_UNLOCK(p1);
/*
* Tell any interested parties about the new process.
*/
knote_fork(p1->p_klist, p2->p_pid);
SDT_PROBE3(proc, , , create, p2, p1, fr->fr_flags);
if (fr->fr_flags & RFPROCDESC) {