svn commit: r256186 - head/sys/netinet
Gleb Smirnoff
glebius at FreeBSD.org
Wed Oct 9 12:00:39 UTC 2013
Author: glebius
Date: Wed Oct 9 12:00:38 2013
New Revision: 256186
URL: http://svnweb.freebsd.org/changeset/base/256186
Log:
When processing ACK in tcp_do_segment, use sbcut_locked() instead of
sbdrop_locked() to cut acked mbufs from the socket buffer. Free this
chain a batch manner after the socket buffer lock is dropped.
This measurably reduces contention on socket buffer.
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
Approved by: re (marius)
Modified:
head/sys/netinet/tcp_input.c
Modified: head/sys/netinet/tcp_input.c
==============================================================================
--- head/sys/netinet/tcp_input.c Wed Oct 9 11:57:53 2013 (r256185)
+++ head/sys/netinet/tcp_input.c Wed Oct 9 12:00:38 2013 (r256186)
@@ -1461,6 +1461,7 @@ tcp_do_segment(struct mbuf *m, struct tc
u_long tiwin;
char *s;
struct in_conninfo *inc;
+ struct mbuf *mfree;
struct tcpopt to;
#ifdef TCPDEBUG
@@ -2718,15 +2719,17 @@ process_ACK:
SOCKBUF_LOCK(&so->so_snd);
if (acked > so->so_snd.sb_cc) {
tp->snd_wnd -= so->so_snd.sb_cc;
- sbdrop_locked(&so->so_snd, (int)so->so_snd.sb_cc);
+ mfree = sbcut_locked(&so->so_snd,
+ (int)so->so_snd.sb_cc);
ourfinisacked = 1;
} else {
- sbdrop_locked(&so->so_snd, acked);
+ mfree = sbcut_locked(&so->so_snd, acked);
tp->snd_wnd -= acked;
ourfinisacked = 0;
}
/* NB: sowwakeup_locked() does an implicit unlock. */
sowwakeup_locked(so);
+ m_freem(mfree);
/* Detect una wraparound. */
if (!IN_RECOVERY(tp->t_flags) &&
SEQ_GT(tp->snd_una, tp->snd_recover) &&
More information about the svn-src-all
mailing list