GNU bug report logs - #8200
cp -lr uses a lot of CPU time.

Previous Next

Package: coreutils;

Reported by: Rogier Wolff <R.E.Wolff <at> BitWizard.nl>

Date: Tue, 8 Mar 2011 05:23:02 UTC

Severity: normal

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Rogier Wolff <R.E.Wolff <at> BitWizard.nl>
To: 8200 <at> debbugs.gnu.org
Subject: bug#8200: cp -lr uses a lot of CPU time. 
Date: Tue, 8 Mar 2011 06:08:40 +0100
Hi, 

In my backupscripts I need a "cp -lr" every day. I make backups of
directories that hold up to millions of files. 

When 

	cp -lr sourc dest

runs for a while, it becomes CPU limited. Virtual memory is only about
2Mb. "resident" is under 1M.

Top reports: 

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
26721 root      20   0  2456  720  468 R 58.0  0.1  65:32.60 cp
 2855 root      20   0  2560  936  624 R 40.8  0.1  30:30.52 cp

and I doubt they are half way through.

I wrote an application I call "cplr" which does the obvious in the
obvious manner, and it doesn't have this problem. 

I've run "strace", and determined that it is not doing systemcalls
that take much CPU time. Most system calls return in microseconds.

The time spent /between/ system calls runs up into the hundreds of
milliseconds. You might say: well that's way less than a
second. Sure. But if you need to do that tens of thousands of times it
becomes quite significant....


So my question is: Why does cp -lr take such rediculous amounts of CPU
time?

Or another way: BUG REPORT: cp -lr takes unneccessary amounts of CPU
time.

	Roger. 

-- 
** R.E.Wolff <at> BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2600998 **
**    Delftechpark 26 2628 XH  Delft, The Netherlands. KVK: 27239233    **
*-- BitWizard writes Linux device drivers for any device you may have! --*
Q: It doesn't work. A: Look buddy, doesn't work is an ambiguous statement. 
Does it sit on the couch all day? Is it unemployed? Please be specific! 
Define 'it' and what it isn't doing. --------- Adapted from lxrbot FAQ




This bug report was last modified 14 years and 133 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.