Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Mar 2008 15:26:35 +0000 (GMT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Petri Helenius <petri@helenius.fi>
Cc:        arch@freebsd.org, freebsd-current@freebsd.org, net@freebsd.org
Subject:   Re: HEADS UP: zerocopy bpf commits impending
Message-ID:  <20080324151814.Y12107@fledge.watson.org>
In-Reply-To: <47E7BB1C.4020703@helenius.fi>
References:  <20080317133029.GA19369@sub.vaned.net> <20080317134335.A3253@fledge.watson.org> <20080324140623.GA14941@sub.vaned.net> <20080324141334.T7797@fledge.watson.org> <47E7BB1C.4020703@helenius.fi>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 24 Mar 2008, Petri Helenius wrote:

> Pardon the basic question, but is the current patchset "zero copy" or "one 
> copy"? The paper I saw a link to described a mechanism to eliminate one of 
> the two copies the traditional bpf approach makes but I haven't taken a look 
> into the actual code.

The short answer is "one-copy".  This eliminates the copy between the kernel 
and user space, but not the possibility of in-kernel copying.  In practice, 
that in-kernel copying is frequently desirable as:

(1) It allows packing of headers into a buffer when a small snaplen is used,
     which greatly reduces memory overhead when capturing, for example, just
     TCP headers and not payloads.

(2) It allows us to more easily maintain independence between separate BPF
     sessions, and in particular, to avoid leaking memory between kernel,
     userspace, and different BPF consumers.

If doing full capture of all packet data to userspace, the approach we took 
would improve performance, but would still involve one full copy of packet 
data in kernel.  Further work would be required to eliminate that copy.

Robert N M Watson
Computer Laboratory
University of Cambridge



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080324151814.Y12107>