Re: zero-copy read() interface
From: Jörn Engel
Date: Thu Aug 18 2005 - 08:14:10 EST
On Thu, 18 August 2005 12:41:32 +0200, Folkert van Heusden wrote:
>
> > Just use mmap(). Unlike your proposal, it cooperates with the page
> > cache.
>
> Doesn't that one also use copying? I've also heard that using mmap is
> expensive due to pagefaulting. I've found, for example, that copying a
> 1.3GB file using read/write instead of mmap & memcpy is seconds faster.
Since you don't consider device DMA to be a copy, no, it doesn't. The
data is transferred into page cache, then the pages are mapped into
your processes memory without an additional copy.
The pagefaulting isn't free either, I agree. And for streaming
accesses like your copy of a large file, taking one fault per 4k
copied is not an ideal case.
Most likely you'd want Linus' pipe stuff for copying a large file
without ever looking at the data. That work is still unfinished,
though, and I'm currently lacking time to work on it.
Jörn
--
He that composes himself is wiser than he that composes a book.
-- B. Franklin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/