lkml.org 
[lkml]   [1998]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Thread implementations...
From
Date
Linus Torvalds <torvalds@transmeta.com> writes:

> I've also done some more testing of sendfile(), and the nice thing is that
> when I compared doing a file copy with sendfile compared to a plain "cp",
> the sendfile implementation was about twice as fast (at least my version
> of "cp" will just do read+write pairs over and over again). When I copied
> a 38MB file the "cp" took 1:58 seconds while sendfile took 1:08 seconds
> according to "time" (I have 512MB of RAM, so this was all cached,
> obviously)..


But how does it look if you compare it to something that uses mmap() ?
On my machine GNU cp always seems to use read/write for copying.

In this situation it would be nice to "redeclare" a mmaped region
to another fd. Currently it would have to do either mmap()->write()
[implicit copy] or mmap()->mmaped region[explicit copy], because one
mmaped data region can only belong to a specific inode.

Something like:
adr = mmap(0, length, PROT_READ, MAP_SHARED, input_fd, offset);
mmap(adr, length, PROT_READ|PROT_WRITE,
MAP_SHARED|MAP_REUSE, output_fd, offset);
msync(adr, length, MS_INVALIDATE);
To copy data without it ever leaving the page cache. Do you think that is
possible, or are the fixed costs of mmap just too big to make it worthwhile?

-Andi



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:43    [W:0.297 / U:0.560 seconds]
©2003-2011 Jasper Spaans. Advertise on this site