Subject: Re: sosend_loan tweak
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-net
Date: 06/14/2006 14:01:44
--Bn2rw/3z4jIqBvZU
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,
>=20
> > 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=
()?
>=20
> how about the attached patch?
> i'll commit it unless anyone objects.
>=20
> 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=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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=
=20
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,

Bill

--Bn2rw/3z4jIqBvZU
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFEkHk4Wz+3JHUci9cRAiSdAJ9Zc+2k2CpGHErokeZeylYD0/yiJgCghGIV
kX4dv3qeymR9lg17NPBxxFo=
=WZm7
-----END PGP SIGNATURE-----

--Bn2rw/3z4jIqBvZU--