tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: getting creative with cp (was Re: cp -n diff)

On Tue, May 10, 2011 at 04:24:30PM -0300, Lourival Vieira Neto wrote:
 > Sorry for the thread hijacking, but, coincidentally, I did an
 > experiment with cp using Lunatik [1] to speed up file copying by
 > avoiding context switches. I based this experiment on the
 > CompositeCalls idea [2] and I used the following Lua script:
 > function copy(fd, fdw, nbytes)
 >         while true do
 >                 local nr = read(fd, nbytes)
 >                 if not nr then break end
 >                 write(fdw, nr)
 >         end
 > end
 > So,  I wrote a C program which uses the Lunatik ioctl [3] and the copy
 > function to copy a file instead of use read/write system calls. As
 > result, I have speedups (in relation to cp(1)) of around 20% with
 > files until ~500M. However, with big files (>= 1G), I have speedups
 > lower than 9%. I didn't understand this behavior yet.

That's basically sendfile, which we don't have because we believe that
UVM's page loaning makes it mostly superfluous. IIUC.

What size copy buffer did you get that speedup with?

 > total memory = 1978 MB
 > avail memory = 1933 MB

That's probably why 1G matters.

David A. Holland

Home | Main Index | Thread Index | Old Index