summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_timer.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2006-09-06 13:56:35 +0000
committerglebius <glebius@FreeBSD.org>2006-09-06 13:56:35 +0000
commitd907e70991e5532d54d44116c5a0b2cc5387db64 (patch)
tree031fd47798744592737db92ae3ba63935183153b /sys/netinet/tcp_timer.c
parent1b7ae73acb536e1260e21e970525999d59fdb060 (diff)
downloadFreeBSD-src-d907e70991e5532d54d44116c5a0b2cc5387db64.zip
FreeBSD-src-d907e70991e5532d54d44116c5a0b2cc5387db64.tar.gz
o Backout rev. 1.125 of in_pcb.c. It appeared to behave extremely
bad under high load. For example with 40k sockets and 25k tcptw entries, connect() syscall can run for seconds. Debugging showed that it iterates the cycle millions times and purges thousands of tcptw entries at a time. Besides practical unusability this change is architecturally wrong. First, in_pcblookup_local() is used in connect() and bind() syscalls. No stale entries purging shouldn't be done here. Second, it is a layering violation. o Return back the tcptw purging cycle to tcp_timer_2msl_tw(), that was removed in rev. 1.78 by rwatson. The commit log of this revision tells nothing about the reason cycle was removed. Now we need this cycle, since major cleaner of stale tcptw structures is removed. o Disable probably necessary, but now unused tcp_twrecycleable() function. Reviewed by: ru
Diffstat (limited to 'sys/netinet/tcp_timer.c')
-rw-r--r--sys/netinet/tcp_timer.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c
index 5c105b4..ca0bd36 100644
--- a/sys/netinet/tcp_timer.c
+++ b/sys/netinet/tcp_timer.c
@@ -288,15 +288,20 @@ tcp_timer_2msl_tw(int reuse)
int i;
INP_INFO_WLOCK_ASSERT(&tcbinfo);
- for (i = 0; i < 2; i++) {
+ for (i = 0; i < TWLIST_NLISTS; i++) {
twl = tw_2msl_list[i];
tw_tail = &twl->tw_tail;
- tw = LIST_FIRST(&twl->tw_list);
- if (tw == tw_tail || (!reuse && tw->tw_time > ticks))
- continue;
- INP_LOCK(tw->tw_inpcb);
- tcp_twclose(tw, reuse);
- return (reuse ? tw : NULL);
+
+ for (;;) {
+ tw = LIST_FIRST(&twl->tw_list);
+ if (tw == tw_tail || (!reuse && tw->tw_time > ticks))
+ break;
+ INP_LOCK(tw->tw_inpcb);
+ tcp_twclose(tw, reuse);
+ if (reuse)
+ return (tw);
+ }
+
}
return (NULL);
}
OpenPOWER on IntegriCloud