From owner-svn-src-all@freebsd.org Thu Apr 16 20:17:25 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C5D52C709E; Thu, 16 Apr 2020 20:17:25 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4939W93bCVz43nL; Thu, 16 Apr 2020 20:17:25 +0000 (UTC) (envelope-from jtl@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 7630CE91A; Thu, 16 Apr 2020 20:17:25 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03GKHPT7095931; Thu, 16 Apr 2020 20:17:25 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03GKHPKc095929; Thu, 16 Apr 2020 20:17:25 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <202004162017.03GKHPKc095929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Thu, 16 Apr 2020 20:17:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360020 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 360020 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Apr 2020 20:17:25 -0000 Author: jtl Date: Thu Apr 16 20:17:24 2020 New Revision: 360020 URL: https://svnweb.freebsd.org/changeset/base/360020 Log: Avoid calling protocol drain routines more than once per reclamation event. mb_reclaim() calls the protocol drain routines for each protocol in each domain. Some protocols exist in more than one domain and share drain routines. In the case of SCTP, it also uses the same drain routine for its SOCK_SEQPACKET and SOCK_STREAM entries in the same domain. On systems with INET, INET6, and SCTP all defined, mb_reclaim() calls sctp_drain() four times. On systems with INET and INET6 defined, mb_reclaim() calls tcp_drain() twice. mb_reclaim() is the only in-tree caller of the pr_drain protocol entry. Eliminate this duplication by ensuring that each pr_drain routine is only specified for one protocol entry in one domain. Reviewed by: tuexen MFC after: 2 weeks Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D24418 Modified: head/sys/netinet/in_proto.c head/sys/netinet6/in6_proto.c Modified: head/sys/netinet/in_proto.c ============================================================================== --- head/sys/netinet/in_proto.c Thu Apr 16 20:07:34 2020 (r360019) +++ head/sys/netinet/in_proto.c Thu Apr 16 20:17:24 2020 (r360020) @@ -163,7 +163,7 @@ struct protosw inetsw[] = { .pr_input = sctp_input, .pr_ctlinput = sctp_ctlinput, .pr_ctloutput = sctp_ctloutput, - .pr_drain = sctp_drain, + .pr_drain = NULL, /* Covered by the SOCK_SEQPACKET entry. */ .pr_usrreqs = &sctp_usrreqs }, #endif /* SCTP */ Modified: head/sys/netinet6/in6_proto.c ============================================================================== --- head/sys/netinet6/in6_proto.c Thu Apr 16 20:07:34 2020 (r360019) +++ head/sys/netinet6/in6_proto.c Thu Apr 16 20:17:24 2020 (r360020) @@ -172,11 +172,11 @@ struct protosw inet6sw[] = { .pr_input = tcp6_input, .pr_ctlinput = tcp6_ctlinput, .pr_ctloutput = tcp_ctloutput, -#ifndef INET /* don't call initialization and timeout routines twice */ +#ifndef INET /* don't call initialization, timeout, and drain routines twice */ .pr_init = tcp_init, .pr_slowtimo = tcp_slowtimo, -#endif .pr_drain = tcp_drain, +#endif .pr_usrreqs = &tcp6_usrreqs, }, #ifdef SCTP @@ -188,8 +188,8 @@ struct protosw inet6sw[] = { .pr_input = sctp6_input, .pr_ctlinput = sctp6_ctlinput, .pr_ctloutput = sctp_ctloutput, +#ifndef INET /* Do not call initialization and drain routines twice. */ .pr_drain = sctp_drain, -#ifndef INET /* Do not call initialization twice. */ .pr_init = sctp_init, #endif .pr_usrreqs = &sctp6_usrreqs @@ -202,7 +202,7 @@ struct protosw inet6sw[] = { .pr_input = sctp6_input, .pr_ctlinput = sctp6_ctlinput, .pr_ctloutput = sctp_ctloutput, - .pr_drain = sctp_drain, + .pr_drain = NULL, /* Covered by the SOCK_SEQPACKET entry. */ .pr_usrreqs = &sctp6_usrreqs }, #endif /* SCTP */