diff options
author | bz <bz@FreeBSD.org> | 2010-03-07 15:58:44 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2010-03-07 15:58:44 +0000 |
commit | 721ece0e76bec904018b373a4c335a5db65474cf (patch) | |
tree | 1f07ab65687e6f16be7044a00fcfbea48b2895c0 /sys/netinet | |
parent | 07f7a52d59d6367b005938bd29cbef2e842616f0 (diff) | |
download | FreeBSD-src-721ece0e76bec904018b373a4c335a5db65474cf.zip FreeBSD-src-721ece0e76bec904018b373a4c335a5db65474cf.tar.gz |
Destroy TCP UMA zones (empty or not) upon network stack teardown
to not leak them, otherwise making UMA/vmstat unhappy with every stoped vnet.
We will still leak pages (especially for zones marked NOFREE).
Reshuffle cleanup order in tcp_destroy() to get rid of what we can
easily free first.
Sponsored by: ISPsystem
Reviewed by: rwatson
MFC after: 5 days
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/tcp_reass.c | 9 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 8 | ||||
-rw-r--r-- | sys/netinet/tcp_timewait.c | 2 | ||||
-rw-r--r-- | sys/netinet/tcp_var.h | 3 |
4 files changed, 21 insertions, 1 deletions
diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index 8115b2b..cd7eb1c 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -132,6 +132,15 @@ tcp_reass_init(void) tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); } +#ifdef VIMAGE +void +tcp_reass_destroy(void) +{ + + uma_zdestroy(V_tcp_reass_zone); +} +#endif + int tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m) { diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 39755f5..4ebdf28 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -459,15 +459,21 @@ void tcp_destroy(void) { - tcp_tw_destroy(); + tcp_reass_destroy(); tcp_hc_destroy(); syncache_destroy(); + tcp_tw_destroy(); /* XXX check that hashes are empty! */ hashdestroy(V_tcbinfo.ipi_hashbase, M_PCB, V_tcbinfo.ipi_hashmask); hashdestroy(V_tcbinfo.ipi_porthashbase, M_PCB, V_tcbinfo.ipi_porthashmask); + + uma_zdestroy(V_sack_hole_zone); + uma_zdestroy(V_tcpcb_zone); + uma_zdestroy(V_tcbinfo.ipi_zone); + INP_INFO_LOCK_DESTROY(&V_tcbinfo); } #endif diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index f755fa1..6e5b013 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -185,6 +185,8 @@ tcp_tw_destroy(void) while((tw = TAILQ_FIRST(&V_twq_2msl)) != NULL) tcp_twclose(tw, 0); INP_INFO_WUNLOCK(&V_tcbinfo); + + uma_zdestroy(V_tcptw_zone); } #endif diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 769c219..3a59eee 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -657,6 +657,9 @@ char *tcp_log_addrs(struct in_conninfo *, struct tcphdr *, void *, const void *); int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); void tcp_reass_init(void); +#ifdef VIMAGE +void tcp_reass_destroy(void); +#endif void tcp_input(struct mbuf *, int); u_long tcp_maxmtu(struct in_conninfo *, int *); u_long tcp_maxmtu6(struct in_conninfo *, int *); |