Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Let the sosend_loan() path be selected at run-time; ...
details: https://anonhg.NetBSD.org/src/rev/6f093066f803
branches: trunk
changeset: 526387:6f093066f803
user: thorpej <thorpej%NetBSD.org@localhost>
date: Fri May 03 00:35:14 2002 +0000
description:
Let the sosend_loan() path be selected at run-time; patch the variable
use_sosend_loan to enable/disable it. The SOSEND_LOAN kernel option
now causes it to default to 1.
diffstat:
sys/kern/uipc_socket.c | 27 ++++++++-------------------
1 files changed, 8 insertions(+), 19 deletions(-)
diffs (121 lines):
diff -r 0109c0376ed9 -r 6f093066f803 sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c Fri May 03 00:27:45 2002 +0000
+++ b/sys/kern/uipc_socket.c Fri May 03 00:35:14 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_socket.c,v 1.64 2002/05/02 17:55:51 thorpej Exp $ */
+/* $NetBSD: uipc_socket.c,v 1.65 2002/05/03 00:35:14 thorpej Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.64 2002/05/02 17:55:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.65 2002/05/03 00:35:14 thorpej Exp $");
#include "opt_sock_counters.h"
#include "opt_sosend_loan.h"
@@ -135,6 +135,10 @@
}
#ifdef SOSEND_LOAN
+int use_sosend_loan = 1;
+#else
+int use_sosend_loan = 0;
+#endif
struct mbuf *so_pendfree;
@@ -303,8 +307,6 @@
return (space);
}
-#endif /* SOSEND_LOAN */
-
/*
* Socket operation routines.
* These routines are called by the routines in
@@ -390,9 +392,7 @@
void
sofree(struct socket *so)
{
-#ifdef SOSEND_LOAN
struct mbuf *m;
-#endif
if (so->so_pcb || (so->so_state & SS_NOFDREF) == 0)
return;
@@ -407,13 +407,11 @@
}
sbrelease(&so->so_snd);
sorflush(so);
-#ifdef SOSEND_LOAN
while ((m = so->so_pendfree) != NULL) {
so->so_pendfree = m->m_next;
m->m_next = so_pendfree;
so_pendfree = m;
}
-#endif
pool_put(&socket_pool, so);
}
@@ -569,9 +567,7 @@
(struct proc *)0);
bad:
splx(s);
-#ifdef SOSEND_LOAN
sodopendfree(so);
-#endif
return (error);
}
@@ -602,9 +598,7 @@
long space, len, resid, clen, mlen;
int error, s, dontroute, atomic;
-#ifdef SOSEND_LOAN
sodopendfree(so);
-#endif
p = curproc; /* XXX */
clen = 0;
@@ -691,8 +685,8 @@
MGET(m, M_WAIT, MT_DATA);
mlen = MLEN;
}
-#ifdef SOSEND_LOAN
- if (uio->uio_iov->iov_len >= SOCK_LOAN_THRESH &&
+ if (use_sosend_loan &&
+ uio->uio_iov->iov_len >= SOCK_LOAN_THRESH &&
space >= SOCK_LOAN_THRESH &&
(len = sosend_loan(so, uio, m,
space)) != 0) {
@@ -700,7 +694,6 @@
space -= len;
goto have_data;
}
-#endif /* SOSEND_LOAN */
if (resid >= MINCLSIZE && space >= MCLBYTES) {
SOSEND_COUNTER_INCR(&sosend_copy_big);
MCLGET(m, M_WAIT);
@@ -728,9 +721,7 @@
}
error = uiomove(mtod(m, caddr_t), (int)len,
uio);
-#ifdef SOSEND_LOAN
have_data:
-#endif
resid = uio->uio_resid;
m->m_len = len;
*mp = m;
@@ -807,9 +798,7 @@
struct protosw *pr;
struct mbuf *nextrecord;
-#ifdef SOSEND_LOAN
sodopendfree(so);
-#endif
pr = so->so_proto;
mp = mp0;
Home |
Main Index |
Thread Index |
Old Index