svn commit: r360020 - in head/sys: netinet netinet6
Jonathan T. Looney
jtl at FreeBSD.org
Thu Apr 16 20:17:25 UTC 2020
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 */
More information about the svn-src-head
mailing list