Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
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: Mainly Debian and Mepis, but also Slackware, Arch and Mandriva
Posts: 73
Rep:
Samba CPU usage
Hi
I'm running Samba under Debian Sarge on a P2-350 box with 64MB RAM. When copying files from a Windows box, the CPU usage quickly jumps to around 10% and continues to increase until it usually hovers at about 30% until the transfer is complete, although on occasions it has been as high as 60-70% (and load averages of around 4) just copying 1 file. Generally when there is heavy disk usage, the system becomes less responsive. (e.g. copying files via samba whilst playing stuff with mpd causes the sound to stutter) I've checked to make sure DMA is enabled using hdparm and also enabled pther options including 'unmask IRQ' which reportedly should lower CPU consumption, to no avail.
EDIT: I've also tried copying files via FTP, which resulted in vsftpd using between 40-98% CPU. I know this isn't a powerful box, but this still seems excessive.
Hmm at first glance I would have said DMA, but you seem sure this isn't the problem.
I had exactly the same problem on my setup (2.6.9 on FC3 on an old P4 3.0gHZ machine) because the 2.6.9 kernel was incapable of using DMA on my particular motherboard. I upgraded to 2.6.14.3 which was capable of using DMA on my motherboard.
E. g. are you SURE DMA isn't the issue here? The exact symptoms you describe is word for word what I was experiencing with Samba on my "DMA-less" old kernel...
One thing you can try (though it might slow down your file transfer to a great degree) is to simply renice the samba processes to have a lower priority - which might help a bit, though maybe not much if something -else- is awry, or some kind of IO bottleneck is present. I've seen this in particular when copying files off an old (300mHz) P2 I've got here, under my DMA-less kernel. Copying from faster machines user Samba choked mine down quite a bit (slow apparent GUI reponse, etc) while copying from the slower machine didn't have that great an effect... Guess it was because the old machine couldn't "shoot" as fast as the newer, faster ones, giving my DMA-less system a bit of a breather since the CPU wasn't off doing the transfer the whole time.
On the other hand, you are using a very minimal system there. Are you using a GUI or running in text mode? If you are running in text mode (runlevel 3) then this shouldn't be such a problem (I used such a system successfully as a development server a while back) but if you are running a GUI this could be a problem, since you will quickly run out of phyiscal RAM. Maybe your system is just slow in general paging out to disk, especially if you start copying huge files?
I have a 1.3 ghz 1gig ram box running debian 3.1 as a file server. If I transfer large files to the box the cpu usuage can go upto 30% to 40%. It will then go down after the transfer has finished.
Thats just the way it is. The system will slow down a little depending on the spec.
Distribution: Mainly Debian and Mepis, but also Slackware, Arch and Mandriva
Posts: 73
Original Poster
Rep:
Hi
dmesg shows that the BIOS detects the drives as PIO, however it seems that it's able to enable DMA anyway: it reports hda as DMA, and hdb as UDMA33 so I assume that the kernel supports DMA (I'm using the stock 2.4.27-386 kernel, but have also tried 2.4.27-686 and 2.6.8-386 and 686 ones.
Distribution: Mainly Debian and Mepis, but also Slackware, Arch and Mandriva
Posts: 73
Original Poster
Rep:
I've done a bit more testing (creating a 1GB file with dd, and then copying it locally (ie. cp 1GB-file 1GB-file_copy), which used up on average about 25% CPU, so it seems the problem isn't actually to do with Samba, but as far as I can tell DMA is enabled and stuff
1337_penguin
Last edited by 1337_penguin; 11-08-2006 at 03:34 PM.
Distribution: Mainly Debian and Mepis, but also Slackware, Arch and Mandriva
Posts: 73
Original Poster
Rep:
Well, I swapped out the card (a Realtek 8139) for an Intel Pro 100 card I had lying around, but the CPU usage is still pretty much the same. As I stated, it also happens when copying files locally (ie. not over the network) (so doesn't appear to be an issue with networking), despite the fact that DMA appears to be enabled. 25% seems rather high for just copying a file, on an otherwise idle box.
It will use CPU, but considering I've got a K6-450 with 192MB of RAM running Shoutcast, Samba (PDC), DNS, Syslog, Squid, NFS, CUPS, Apache, and IRC on that box. . .yeah. . .you shouldn't be encountering skips while playing an MP3 if I don't. I have to try to make mine skip, and that's by doing something I KNOW will bog it down (like run Shoutcast and a Q3 server at the same time).
What type of hard drive are you using? Just because the kernel detects something as DMA, doesn't mean it auto sets it to use DMA. Do an hdparm /dev/hd(x) and see what pops up, and try hdparm -i /dev/hd(x). I had an issue with one kernel dropping DMA occasionally even though I turned it on. But even in that case, crap never skipped. The slowest hard drive I ever put in my system was an ATA/66 drive, but the chipset still maxes out at about 7MB/s transfer to and fro (the -i will tell you the disk read speed). You may need to tweak up your hard drive (multicount, DMA, unmask, IO Support) and see if that helps a little. Heck, you may simply just need 128MB of RAM and everything will be fine, too. Although, I'd whole-heartedly suggest the RAM upgrade anyway, since everything your computer does hits memory before doing anything else.
I've tried various options with hdparm (such as -c3 -m16 -d1 -u1) but nothing really seems to make a difference. I also added an extra 128MB of RAM, but likewise that doesn't seem to help either.
Last edited by 1337_penguin; 11-10-2006 at 02:20 PM.
That's weird. Here's an output from my little K6-III box:
Code:
Apollo arcruea # hdparm -I /dev/hda
/dev/hda:
ATA device, with non-removable media
Model Number: ST320011A
Serial Number: 3HT3ALXN
Firmware Revision: 3.75
Standards:
Supported: 5 4 3 2
Likely used: 6
Configuration:
Logical max current
cylinders 16383 16383
heads 16 16
sectors/track 63 63
--
CHS current addressable sectors: 16514064
LBA user addressable sectors: 39102336
device size with M = 1024*1024: 19092 MBytes
device size with M = 1000*1000: 20020 MBytes (20 GB)
Capabilities:
LBA, IORDY(can be disabled)
bytes avail on r/w long: 4 Queue depth: 1
Standby timer values: spec'd by Standard
R/W multiple sector transfer: Max = 16 Current = 16
Recommended acoustic management value: 128, current value: 128
DMA: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4 udma5
Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4
Cycle time: no flow control=240ns IORDY flow control=120ns
Commands/features:
Enabled Supported:
* READ BUFFER cmd
* WRITE BUFFER cmd
* Host Protected Area feature set
* Look-ahead
* Write cache
* Power Management feature set
Security Mode feature set
* SMART feature set
Device Configuration Overlay feature set
* Automatic Acoustic Management feature set
SET MAX security extension
* DOWNLOAD MICROCODE cmd
Security:
Master password revision code = 65534
supported
not enabled
not locked
not frozen
not expired: security count
not supported: enhanced erase
HW reset results:
CBLID- above Vih
Device num = 1
Checksum: correct
Apollo arcruea #
Just curious, did you compile your own kernel? If so, there may be some modules missing that are needed, most notably like the DMA and generic motherboard support.
I can tell you, though, you shouldn't have skipping problems with Samba unless you're weighing that thing down heavier than hell.
Distribution: Mainly Debian and Mepis, but also Slackware, Arch and Mandriva
Posts: 73
Original Poster
Rep:
I'm just using Debian's default 2.4.27-386 kernel, but have also tried with the 2.4.27-686 and 2.6.8 386 and 686 ones (acquired via apt-get). I assume all those would include the necessary modules. (considering that dmesg and hdaprm seems to suggest that DMA is enabled and lsmod shows 'piix' in the list)
I haven't had much luck compiling kernels in the past - I tend to get to building stage, but it just produces loads of errors and I have no idea where to start looking in order to fix them.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.