Subject: Re: zbufs for NetBSD
To: None <kyle.unice@L-3com.com>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 08/23/2002 08:38:35
On Fri, Aug 23, 2002 at 08:12:34AM -0600, kyle.unice@L-3com.com wrote:

 > The salient point is that copying memory from one buffer to another will
 > always take longer than passing a pointer.  The larger the amount of memory

That is *not* always true.

In a virtual memory system, "passing a pointer" across a protection boundary
involves changing mappings, which potentially means cache flushing and TLB
invalidation traffic.  The latter can potentially be expensive on a multi-
processor.

For small amounts of data, and even moderate amounts of data, a copy may
in fact be faster than remapping the data.

Now, you talk about VxWorks being ring0 only... THAT would be analogous
to an application running entirely in the NetBSD kernel.  In that case,
NetBSD *already* has the zero-copy semantics I described before (with
the exception of how data is compacted in the socket buffer ... but that
is certainly something that can be tuned, and it only does the compaction
for small amounts of data anyway).

For userland, which VxWorks as you describe it doesn't really have, the
situation is quite different.

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