high memory and cpu usage when copying large amounts, KSWAPD0
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: CentOS, RHEL, Solaris 10, AIX, HP-UX
Posts: 731
Rep:
memory usage is done to buffer files into memory, so that a write to the target disk is not done for each single file.
kswapd is kernel swap daemon, a part of the virtual memory usage. This has only partially to do with swap space. kswapd organizes which memory pages to swap in/out or to disk. High usage of kswapd was in older kernel version a bug, but should be fixed.
Could you provide some more information?
Did you use
Code:
iostat
vmstat
sar
to check what your system is really doing on I/O and memory? What disks are you using? PATA/SATA/SCSI? Are you really copying between two disks or between two partitions on the same disk?
It sounds like the program that you're using is slurping the entire file into a memory-buffer, then writing it all out again.
The problem with this very-common (and, very-misguided...) strategy is of course that "memory" is virtual, that is to say, "a disk file."
Most operating systems, no doubt including Linux, provide a standard "file copy" primitive which is designed to be very efficient. Clearly, this is not how the program-in-question is now doing things. Clearly also, the correct solution is to rewrite or to replace it, your choice.
Last edited by sundialsvcs; 08-02-2011 at 06:28 AM.
pprocs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
2 0 3760 223136 4040 855424 0 0 78 79 321 1418 3 6 90 1
Sar gives me an error; Cannot open /var/log/sa/sa29: No such file or directory.
Yes, I am copying from one hard drive to the other. I have SATA drives. I have however seen that the problem also persists if I do large operations on the target drive only.
As to the strange program I'm using..... it is just "cp" !
ps im on arch linux 86_64 using GPT partition tables and LVM on a Samsung HD204UI
Having said that, you also need to be wary of "lies, damned lies, and statistics." It is possible that what you are seeing in the stats for kswapd is, simply, the I/O that is taking place.
Last edited by sundialsvcs; 08-02-2011 at 06:33 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.