svn commit: r183870 - in stable/7/sys: . kern netinet

Robert Watson rwatson at FreeBSD.org
Tue Oct 14 07:58:19 UTC 2008


Author: rwatson
Date: Tue Oct 14 07:58:18 2008
New Revision: 183870
URL: http://svn.freebsd.org/changeset/base/183870

Log:
  Merge r183662 and r183663 from head to stable/7:
  
    Don't pass curthread to sbreserve_locked() in tcp_do_segment(), as the
    netisr or ithread's socket buffer size limit is not the right limit to
    use.  Instead, pass NULL as the other two calls to sbreserve_locked()
    in the TCP input path (tcp_mss()) do.
  
    In practice, this is a no-op, as ithreads and the netisr run without a
    process limit on socket buffer use, and a NULL thread pointer leads to
    not using the process's limit, if any.  However, if tcp_input() is
    called in other contexts that do have limits, this may prevent the
    incorrect limit from being used.
  
    Rewrite sbreserve_locked()'s comment on NULL thread pointers, eliminating
    an XXXRW about the comment being stale.
  
  Approved by:	re (gnn)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/kern/uipc_sockbuf.c
  stable/7/sys/netinet/tcp_input.c

Modified: stable/7/sys/kern/uipc_sockbuf.c
==============================================================================
--- stable/7/sys/kern/uipc_sockbuf.c	Tue Oct 14 07:52:47 2008	(r183869)
+++ stable/7/sys/kern/uipc_sockbuf.c	Tue Oct 14 07:58:18 2008	(r183870)
@@ -283,10 +283,11 @@ sbreserve_locked(struct sockbuf *sb, u_l
 	SOCKBUF_LOCK_ASSERT(sb);
 
 	/*
-	 * td will only be NULL when we're in an interrupt (e.g. in
-	 * tcp_input()).
-	 *
-	 * XXXRW: This comment needs updating, as might the code.
+	 * When a thread is passed, we take into account the thread's socket
+	 * buffer size limit.  The caller will generally pass curthread, but
+	 * in the TCP input path, NULL will be passed to indicate that no
+	 * appropriate thread resource limits are available.  In that case,
+	 * we don't apply a process limit.
 	 */
 	if (cc > sb_max_adj)
 		return (0);

Modified: stable/7/sys/netinet/tcp_input.c
==============================================================================
--- stable/7/sys/netinet/tcp_input.c	Tue Oct 14 07:52:47 2008	(r183869)
+++ stable/7/sys/netinet/tcp_input.c	Tue Oct 14 07:58:18 2008	(r183870)
@@ -1215,7 +1215,7 @@ tcp_do_segment(struct mbuf *m, struct tc
 				 */
 				if (newsize)
 					if (!sbreserve_locked(&so->so_rcv,
-					    newsize, so, curthread))
+					    newsize, so, NULL))
 						so->so_rcv.sb_flags &= ~SB_AUTOSIZE;
 				m_adj(m, drop_hdrlen);	/* delayed header drop */
 				sbappendstream_locked(&so->so_rcv, m);


More information about the svn-src-all mailing list