summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_subr.c
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2016-04-09 12:05:23 +0000
committerbz <bz@FreeBSD.org>2016-04-09 12:05:23 +0000
commit0a1a3e73fc3c60bf53b8881f9d1e751025e37567 (patch)
tree1eccaf9c5a287aeebbea67777e3090f89ef4cf11 /sys/netinet/tcp_subr.c
parente1837bd3b608bd731cbff92f07b7fa8adfac3ba0 (diff)
downloadFreeBSD-src-0a1a3e73fc3c60bf53b8881f9d1e751025e37567.zip
FreeBSD-src-0a1a3e73fc3c60bf53b8881f9d1e751025e37567.tar.gz
Mfp: r296310,r296343
It looks like as with the safety belt of DELAY() fastened (*) we can completely tear down and free all memory for TCP (after r281599). (*) in theory a few ticks should be good enough to make sure the timers are all really gone. Could we use a better matric here and check a tcbcb count as an optimization? PR: 164763 Reviewed by: gnn, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5734
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r--sys/netinet/tcp_subr.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 56283db..aa24299 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -660,7 +660,7 @@ tcp_init(void)
* These have to be type stable for the benefit of the timers.
*/
V_tcpcb_zone = uma_zcreate("tcpcb", sizeof(struct tcpcb_mem),
- NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
+ NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
uma_zone_set_max(V_tcpcb_zone, maxsockets);
uma_zone_set_warning(V_tcpcb_zone, "kern.ipc.maxsockets limit reached");
@@ -670,7 +670,7 @@ tcp_init(void)
TUNABLE_INT_FETCH("net.inet.tcp.sack.enable", &V_tcp_do_sack);
V_sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole),
- NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
+ NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
/* Skip initialization of globals for non-default instances. */
if (!IS_DEFAULT_VNET(curvnet))
@@ -737,10 +737,21 @@ tcp_destroy(void)
{
int error;
+ /*
+ * All our processes are gone, all our sockets should be cleaned
+ * up, which means, we should be past the tcp_discardcb() calls.
+ * Sleep to let all tcpcb timers really disappear and then cleanup.
+ * Timewait will cleanup its queue and will be ready to go.
+ * XXX-BZ In theory a few ticks should be good enough to make sure
+ * the timers are all really gone. We should see if we could use a
+ * better metric here and, e.g., check a tcbcb count as an optimization?
+ */
+ DELAY(1000000 / hz);
tcp_hc_destroy();
syncache_destroy();
tcp_tw_destroy();
in_pcbinfo_destroy(&V_tcbinfo);
+ /* tcp_discardcb() clears the sack_holes up. */
uma_zdestroy(V_sack_hole_zone);
uma_zdestroy(V_tcpcb_zone);
OpenPOWER on IntegriCloud