Subject: Re: sosend_loan tweak
To: YAMAMOTO Takashi <>
From: Bill Studenmund <>
List: tech-net
Date: 06/14/2006 14:01:44
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Jun 14, 2006 at 11:54:24PM +0900, YAMAMOTO Takashi wrote:
> hi,
> > Or if you don't want to put the setsockopt()s into your application,
> > how about changing the default watermarks to be more friendly to sosend=
> how about the attached patch?
> i'll commit it unless anyone objects.
> YAMAMOTO Takashi

> Index: kern/uipc_socket2.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> --- kern/uipc_socket2.c	(revision 1673)
> +++ kern/uipc_socket2.c	(revision 1674)
> @@ -385,7 +385,7 @@ soreserve(struct socket *so, u_long sndc
>  	if (so->so_rcv.sb_lowat =3D=3D 0)
>  		so->so_rcv.sb_lowat =3D 1;
>  	if (so->so_snd.sb_lowat =3D=3D 0)
> -		so->so_snd.sb_lowat =3D MCLBYTES;
> +		so->so_snd.sb_lowat =3D MAX(MCLBYTES, sock_loan_thresh);

If I understand what you're doing, you make sock_loan_thresh variable. If=
loaning is off, we set it to INT_MAX, which will cause the loan code to=20
never trigger.

But then wouldn't the above code put the low water at INT_MAX too? That=20
seems like we'd then not have correct high/low water dynamics.

Other than this, the change looks fine.

Take care,


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.2.3 (NetBSD)