From owner-freebsd-current@FreeBSD.ORG Mon Mar 24 15:26:37 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17BE2106566B; Mon, 24 Mar 2008 15:26:37 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.freebsd.org (Postfix) with ESMTP id B22198FC21; Mon, 24 Mar 2008 15:26:36 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 9388746B0C; Mon, 24 Mar 2008 11:26:35 -0400 (EDT) Date: Mon, 24 Mar 2008 15:26:35 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Petri Helenius In-Reply-To: <47E7BB1C.4020703@helenius.fi> Message-ID: <20080324151814.Y12107@fledge.watson.org> 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> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: arch@freebsd.org, freebsd-current@freebsd.org, net@freebsd.org Subject: Re: HEADS UP: zerocopy bpf commits impending X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Mar 2008 15:26:37 -0000 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