Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Mar 2001 11:14:36 -0800
From:      Alfred Perlstein <bright@wintelcom.net>
To:        Maxime Henrion <mux@qualys.com>
Cc:        arch@FreeBSD.ORG, Dag-Erling Smorgrav <des@ofug.org>
Subject:   Re: Proposal for a new syscall
Message-ID:  <20010317111436.C29888@fw.wintelcom.net>
In-Reply-To: <20010317194127.D420@nebula.cybercable.fr>; from mux@qualys.com on Sat, Mar 17, 2001 at 07:41:27PM %2B0100
References:  <20010317164411.A420@nebula.cybercable.fr> <xzpzoekcs3r.fsf@flood.ping.uio.no> <20010317173444.B420@nebula.cybercable.fr> <xzp4rwsco0r.fsf@flood.ping.uio.no> <20010317183137.C420@nebula.cybercable.fr> <xzpzoekb5zt.fsf@flood.ping.uio.no> <20010317194127.D420@nebula.cybercable.fr>

next in thread | previous in thread | raw e-mail | index | archive | help
* Maxime Henrion <mux@qualys.com> [010317 10:42] wrote:
> Dag-Erling Smorgrav wrote:
> > Maxime Henrion <mux@qualys.com> 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




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