Subject: sosend_loan tweak
To: None <tech-net@netbsd.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-net
Date: 07/15/2005 19:21:07
--NextPart-20050715191446-0029300
Content-Type: Text/Plain; charset=us-ascii
hi,
currently, when doing tcp bulk send and send buffer is filled up,
we ends up with per-ack small copyin()s rather than page loaning.
the attached patch is to increase chances to use loaning by giving it
some "bonus" buffer space.
in my test environment, it actually yields some noticable improvements.
comments?
YAMAMOTO Takashi
--NextPart-20050715191446-0029300
Content-Type: Text/Plain; charset=us-ascii
Content-Disposition: attachment; filename="a.diff"
Index: uipc_socket.c
===================================================================
--- uipc_socket.c (revision 1248)
+++ uipc_socket.c (working copy)
@@ -148,6 +148,7 @@ struct mbuf *so_pendfree;
#ifndef SOMAXKVA
#define SOMAXKVA (16 * 1024 * 1024)
#endif
+int sosend_loan_bonus = 4096;
int somaxkva = SOMAXKVA;
int socurkva;
int sokvawaiters;
@@ -825,9 +826,10 @@ sosend(struct socket *so, struct mbuf *a
MCLAIM(m, so->so_snd.sb_mowner);
if (use_sosend_loan &&
uio->uio_iov->iov_len >= SOCK_LOAN_THRESH &&
- space >= SOCK_LOAN_THRESH &&
+ space + sosend_loan_bonus >=
+ SOCK_LOAN_THRESH &&
(len = sosend_loan(so, uio, m,
- space)) != 0) {
+ space + sosend_loan_bonus)) != 0) {
SOSEND_COUNTER_INCR(&sosend_loan_big);
space -= len;
goto have_data;
--NextPart-20050715191446-0029300--