From owner-svn-src-projects@freebsd.org Wed Mar 2 11:18:19 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85C09ABF69F for ; Wed, 2 Mar 2016 11:18:19 +0000 (UTC) (envelope-from bz@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 mx1.freebsd.org (Postfix) with ESMTPS id 3DB3A198C; Wed, 2 Mar 2016 11:18:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u22BIITZ076148; Wed, 2 Mar 2016 11:18:18 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u22BII4Q076146; Wed, 2 Mar 2016 11:18:18 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201603021118.u22BII4Q076146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 2 Mar 2016 11:18:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r296310 - projects/vnet/sys/netinet X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Mar 2016 11:18:19 -0000 Author: bz Date: Wed Mar 2 11:18:17 2016 New Revision: 296310 URL: https://svnweb.freebsd.org/changeset/base/296310 Log: It looks like as with the safety belt of DELAY(hz) 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. I wonder if we could use a better matric here and check a tcbcb count as an optimization. Sponsored by: The FreeBSD Foundation Modified: projects/vnet/sys/netinet/tcp_subr.c projects/vnet/sys/netinet/tcp_timewait.c Modified: projects/vnet/sys/netinet/tcp_subr.c ============================================================================== --- projects/vnet/sys/netinet/tcp_subr.c Wed Mar 2 10:23:50 2016 (r296309) +++ projects/vnet/sys/netinet/tcp_subr.c Wed Mar 2 11:18:17 2016 (r296310) @@ -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,18 @@ tcp_destroy(void *unused __unused) { int error; + /* + * All our processes are gone, all our sockets should be cleaned + * up, which means, which should past the tcp_discardcb() calls. + * Sleep to let all tcpcb timers really disappear and then cleanup. + * Timewait will cleanup it's queue and will be ready to go. + */ + DELAY(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); Modified: projects/vnet/sys/netinet/tcp_timewait.c ============================================================================== --- projects/vnet/sys/netinet/tcp_timewait.c Wed Mar 2 10:23:50 2016 (r296309) +++ projects/vnet/sys/netinet/tcp_timewait.c Wed Mar 2 11:18:17 2016 (r296310) @@ -186,7 +186,7 @@ tcp_tw_init(void) { V_tcptw_zone = uma_zcreate("tcptw", sizeof(struct tcptw), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); TUNABLE_INT_FETCH("net.inet.tcp.maxtcptw", &maxtcptw); if (maxtcptw == 0) uma_zone_set_max(V_tcptw_zone, tcptw_auto_size());