tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

tcp_vtw fail (was: Re: CVS commit: src)



On Mon, May 16, 2011 at 06:36:08AM +0000, David Holland wrote:
 > This changeset broke my qemu test environment. With DIAGNOSTIC, DEBUG,
 > and LOCKDEBUG boot gets as far as starting init; then it sits there
 > for a while and after a few moments prints
 > 
 >    UVM: pid 2 (sh), uid 0 killed: out of swap
 >    Out of memory allocating ksiginfo for pid 2
 > 
 > several times (that is, it kills pid 2 several times, which is itself
 > odd) and then asserts at line 2383 of pmap.c, which is in pmap_destroy
 > checking pmap.pm_obj[i].uo_npages == 0.

Yeah, so this turns out to be because the tcp_vtw code unconditionally
allocates about 9M of memory for vestigial connection entries (or
some such thing) even when it's AFAICT not in use.

plz fix.

In the meantime, this patch works around the problem while hopefully
not making the vtw code totally useless:

diff -r e29d039dd4dc sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c    Tue May 17 04:03:21 2011 -0400
+++ b/sys/netinet/tcp_subr.c    Tue May 17 04:04:33 2011 -0400
@@ -215,7 +215,7 @@
 int    tcp4_vtw_enable = 0;            /* 1 to enable */
 int    tcp6_vtw_enable = 0;            /* 1 to enable */
 int    tcp_vtw_was_enabled = 0;
-int    tcp_vtw_entries = 1 << 16;      /* 64K vestigial TIME_WAIT entries */
+int    tcp_vtw_entries = 1 << 4;       /* 16 vestigial TIME_WAIT entries */
 
 /* tcb hash */
 #ifndef TCBHASHSIZE


also, I have a feeling this patch may be wanted, although I'm not
sure; without this patch this function is different from three other
comparable cases for no clear reason. But I haven't really waded
through the code so it's not necessarily the case. It is not what I
was tripping on, in any event.

diff -r 1c84cdf6fda7 sys/netinet6/in6_pcb.c
--- a/sys/netinet6/in6_pcb.c    Tue May 17 02:54:40 2011 -0400
+++ b/sys/netinet6/in6_pcb.c    Tue May 17 03:10:22 2011 -0400
@@ -1121,6 +1121,9 @@
        struct in6pcb *in6p;
        u_int16_t fport = fport_arg, lport = lport_arg;
 
+       if (vp)
+               vp->valid = 0;
+
        head = IN6PCBHASH_CONNECT(table, faddr6, fport, laddr6, lport);
        LIST_FOREACH(inph, head, inph_hash) {
                in6p = (struct in6pcb *)inph;



(note: I don't normally read tech-net, so cc me if anything
interesting develops there)
-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index