[lkml]   [2000]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: zero-copy TCP

On Sun, 3 Sep 2000, Lincoln Dale wrote:
> many people (myself included) have been experimenting with zerocopy
> infrastructures.
> in my case, i've been working on it as time permits for quite a few months
> now, and am about on my fourth rewrite.


> i've found exactly what you state about the bad things that occur when you
> associate zerocopy infrastructure with user-space code. some of the the MM
> tricks required for handling individual pages effectively kills any
> performance gain.
> however, approaching it from the other angle of "buffers pinned in kernel
> memory" can give you a huge win.

I agree.

The "send data from already pinned buffers" case is different. That is
basically why "sendfile()" exists, and why TUX gets good numbers. Once you
get away from the "zero copy from user space" mentality, and start just
passing kernel buffers around, things look a lot better.

> for the application which prompted me to begin looking at this problem,
> where packets typically go network -> RAM -> network, providing a zerocopy
> infrastructure for (a) viewing incoming packet streams pinned in kernel
> memory from user-space [a sort-of SIGIO with pointers to the buffers], and
> (b) hooks for user-space directing the kernel to do things with these
> buffers [eg. "queue buffer A for output on fd Y"] has provided an immediate
> 60% performance gain.

You really should look into using the page cache if you can: that way you
have a very natural way of looking at it and possibly changing the stream
in user mode with no extra copies for that side either.

I'm not saying that you should necessarily actually go to a "real file",
but the best way of allowing user-space access to things like this is
through mmap(), and if you make it look like the page cache you'll get a
lot of code for free...


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:38    [W:0.089 / U:1.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site