From owner-svn-src-head@freebsd.org Sat Dec 8 06:34:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 107211333AF3; Sat, 8 Dec 2018 06:34:14 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A99F6702B1; Sat, 8 Dec 2018 06:34:13 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 890031E908; Sat, 8 Dec 2018 06:34:13 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB86YDVc011824; Sat, 8 Dec 2018 06:34:13 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB86YDfq011822; Sat, 8 Dec 2018 06:34:13 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812080634.wB86YDfq011822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 8 Dec 2018 06:34:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341722 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341722 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A99F6702B1 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 06:34:14 -0000 Author: mjg Date: Sat Dec 8 06:34:12 2018 New Revision: 341722 URL: https://svnweb.freebsd.org/changeset/base/341722 Log: 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 Modified: head/sys/kern/kern_event.c head/sys/kern/kern_fork.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Sat Dec 8 06:31:43 2018 (r341721) +++ head/sys/kern/kern_event.c Sat Dec 8 06:34:12 2018 (r341722) @@ -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); } /* Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Sat Dec 8 06:31:43 2018 (r341721) +++ head/sys/kern/kern_fork.c Sat Dec 8 06:34:12 2018 (r341722) @@ -686,15 +686,15 @@ do_fork(struct thread *td, struct fork_req *fr, struct PROC_UNLOCK(p2); /* - * Now can be swapped. + * Tell any interested parties about the new process. */ - _PRELE(p1); - PROC_UNLOCK(p1); + knote_fork(p1->p_klist, p2->p_pid); /* - * Tell any interested parties about the new process. + * Now can be swapped. */ - knote_fork(p1->p_klist, p2->p_pid); + _PRELE(p1); + PROC_UNLOCK(p1); SDT_PROBE3(proc, , , create, p2, p1, fr->fr_flags); if (fr->fr_flags & RFPROCDESC) {