From owner-freebsd-arch Sat Mar 17 11:14:42 2001 Delivered-To: freebsd-arch@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 3619937B719 for ; Sat, 17 Mar 2001 11:14:39 -0800 (PST) (envelope-from bright@fw.wintelcom.net) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id f2HJEag27775; Sat, 17 Mar 2001 11:14:36 -0800 (PST) Date: Sat, 17 Mar 2001 11:14:36 -0800 From: Alfred Perlstein To: Maxime Henrion Cc: arch@FreeBSD.ORG, Dag-Erling Smorgrav Subject: Re: Proposal for a new syscall Message-ID: <20010317111436.C29888@fw.wintelcom.net> References: <20010317164411.A420@nebula.cybercable.fr> <20010317173444.B420@nebula.cybercable.fr> <20010317183137.C420@nebula.cybercable.fr> <20010317194127.D420@nebula.cybercable.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010317194127.D420@nebula.cybercable.fr>; from mux@qualys.com on Sat, Mar 17, 2001 at 07:41:27PM +0100 X-all-your-base: are belong to us. Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Maxime Henrion [010317 10:42] wrote: > Dag-Erling Smorgrav wrote: > > Maxime Henrion writes: > > > > > > > such a syscall in the kernel would allow to implement "zero-copy" > > > > > > > wherever it is feasible. > > > > > > No. It would save you two copies and a bunch of syscalls, but it > > > > > > wouldn't be real zero-copy, just "n-2 copy" instead of "n copy". > > > > > And if n == 2 ? > > > > It's never the case. I think the best you can do in userland is n = 3, > > > I'm talking about a syscall. > > Yes. I already told you that your proposed syscall would at best > > reduce the number of copies by two. Now I'm telling you that the > > minimum number of copies, without your proposed syscall, can't be less > > than 3. You do the math. > > Ok. > > > > Why couldn't it be zero-copy if sendfile() already does this ? > > Sendfile(2) doesn't do zero-copy, it does 2-copy (in the best of > > cases). > > Thanks, I stand corrected. Perhaps that should be mentioned in the man > page ? Currently, it says this : > > IMPLEMENTATION NOTES > The FreeBSD implementation of sendfile() is "zero-copy", meaning that it > has been optimized so that copying of the file data is avoided. That's market speak. There's at least one copy when the kernel asks the disk to DMA the data in. And there's _always_ another copy when the ethernet hardware reads the data to translate it into whatever it speaks over the cable. My viewpoint is that you don't understand funopen() (which is really ok because I haven't bothered to look into it either) and DES is being somewhat evil by not getting to the above mentioned point... that almost nothing is trully "zero copy". So go knock yourself out, it'd be nice to have a generic tee(2) or kdma(2) syscall to effeciently pipe data from one fd to another. -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message