Subject: Re: Wart in tcp_output(), IPv6-related?
To: None <itojun@iijlab.net>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: tech-net
Date: 04/26/2002 18:29:36
On Sat, Apr 27, 2002 at 09:18:33AM +0900, itojun@iijlab.net wrote:

 > 	and if you really want to make sure there'll be no copy in the function,
 > 	you can get rid of "if (len <= M_TRAILINGSPACE)" case.
 > 	my proposed diff attached.

Well, that doesn't actually guarantee there will be no copy.  If the source
mbuf in the socket buffer is not M_EXT, then it will copy.

It seems reasonable to copy if both:

	* len is "small"

	* Source data from socket buffer is not M_EXT

...since if the second is true, we'll have to copy anyway, and copying
directly into the header mbuf saves allocating a second mbuf.

(Eventually, I'd like to eliminate mbuf-internal-storage completely
and go all-external-storage, making the mbuf structure itself just
metadata, which would allow us to eliminate small copies, too, but
there's lots of other, much lower-hanging fruit to deal with right now :-)

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>