100% CPU usage during disk I/O with SATA/PATA
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux-meta (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
I'm seeing 100% CPU usage during SATA disk I/O in a new PC I've put together. The machine consists of:
MSI K9N6GM-V Mainboard (nForce 410, MCP61)
AMD Sempron LE1100 CPU
512MB Generic 667MHz DDR2 Memory (PC2-5400)
Western Digital WD800AAJS 80GB Hard Drive (SATA-II)
Optiarc AD-7200S DVD Writer (SATA)
OS is Kubuntu Gutsy with all updates to 16/02/2008 (Security and Recommended enabled via Adept). Filesystem is EXT3, and the sata_nv driver is in use.
When copying files using Dolphin, I noticed CPU usage hit 100% with most of it consumed by non-user processes. I ran a few simple tests along with "vmstat 5" -- a few lines of vmstat output are included for each test (note: testfile grew to about 1.5GB before I interrupted dd).
$ dd if=/dev/zero of=testfile
procs -------
r b swpd free buff cache si so bi bo in cs us sy id wa
2 1 47968 4896 440 244308 0 0 10 16604 236 173 1 63 0 36
1 1 47968 5060 400 244132 0 0 2 19929 240 169 1 79 0 20
1 1 47968 4600 476 244724 0 0 26 21610 254 218 2 84 0 14
0 1 47968 5916 512 243336 0 0 1 22442 252 209 2 91 0 7
$ cp testfile anotherfile
procs -------
r b swpd free buff cache si so bi bo in cs us sy id wa
0 1 47968 5744 1136 241456 0 0 27061 27391 525 524 3 48 0 50
1 0 47968 5320 732 242356 0 0 25549 25754 522 507 1 46 0 53
1 0 47968 5472 836 242096 0 0 26468 25763 521 570 1 48 0 51
1 1 47968 5204 768 242352 0 0 25908 26580 523 502 1 46 0 53
SATA controller as listed by lspci:
00:08.0 IDE interface: nVidia Corporation MCP61 SATA Controller (rev a2)
References to the hard drive from dmesg:
[ 24.183650] ata1.00: ATA-7: WDC WD800AAJS-00PSA0, 05.06H05, max UDMA/133
[ 25.008131] scsi 0:0:0:0: Direct-Access ATA WDC WD800AAJS-00 05.0 PQ: 0 ANSI: 5
DMA-related information for the hard drive from hdparm:
DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
Cycle time: min=120ns recommended=120ns
The DVD writer info from dmesg:
[ 24.828310] ata2.00: ATAPI: Optiarc DVD RW AD-7200S, 1.01, max UDMA/100
[ 25.009770] scsi 1:0:0:0: CD-ROM Optiarc DVD RW AD-7200S 1.01 PQ: 0 ANSI: 5
And finally a few lines from top whilst copying 2GB of files using Dolphin:
Tasks: 108 total, 3 running, 104 sleeping, 0 stopped, 1 zombie
Cpu(s): 5.3%us, 26.2%sy, 0.0%ni, 0.0%id, 67.4%wa, 0.3%hi, 0.7%si, 0.0%st
Mem: 450688k total, 444776k used, 5912k free, 700k buffers
Swap: 1020116k total, 35772k used, 984344k free, 243576k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
14408 bob 18 0 26408 5484 3884 R 17.3 1.2 0:14.64 kio_file
5781 bob 15 0 47312 8800 5340 S 5.6 2.0 0:08.94 artsd
14021 root 15 0 0 0 0 D 4.0 0.0 0:07.14 pdflush
169 root 10 -5 0 0 0 S 1.7 0.0 0:09.56 kswapd0
4022 root 10 -5 0 0 0 S 1.7 0.0 0:06.84 kjournald
4844 root 15 0 57996 44m 5396 S 0.7 10.1 5:54.90 Xorg
5716 bob 15 0 25844 3120 1764 S 0.7 0.7 0:02.41 dcopserver
5739 bob 15 0 32524 12m 9.9m S 0.7 2.9 0:03.44 kio_uiserver
13846 bob 15 0 43272 21m 17m S 0.7 4.9 0:15.28 d3lphin
1 root 15 0 2952 1856 532 S 0.0 0.4 0:01.16 init
Changed in linux-meta: | |
status: | Invalid → Incomplete |
I managed to dig out a PATA drive to repeat the above tests on the same machine. Interestingly, this also wipes out 100% CPU, which I must admit I wasn't expecting!
$ dd if=/dev/zero of=testfile
procs ------- ----memory- ------- -- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
1 0 34788 5308 560 305108 0 0 1 27740 314 394 2 95 0 3
1 0 34788 5336 596 305076 0 0 30 30470 311 413 3 93 0 4
1 0 34788 5824 520 304720 0 0 1 23742 345 453 2 93 0 5
1 0 34788 5400 540 305212 0 0 5 30498 309 369 7 89 0 4
$ cp testfile anotherfile
procs ------- ----memory- ------- -- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
2 0 34788 5980 1784 302360 0 0 13070 13304 328 476 0 33 0 67
0 1 34788 5240 1828 303584 0 0 12607 14122 319 456 1 34 0 65
1 0 34788 5136 1912 304420 0 0 12788 12462 326 462 1 31 0 68
0 1 34788 5440 1032 305172 0 0 12644 13292 325 453 1 32 0 67
PATA controller as listed by lspci:
00:06.0 IDE interface: nVidia Corporation MCP61 IDE (rev a2)
hdparm information for the PATA drive:
/dev/hda:
multcount = 0 (off)
IO_support = 1 (32-bit)
unmaskirq = 1 (on)
using_dma = 1 (on)
keepsettings = 0 (off)
readonly = 0 (off)
readahead = 256 (on)
geometry = 36481/255/63, sectors = 586072368, start = 0
Also did some basic comparison between the Windows XP install on the machine against the Kubuntu install. Used 3 CD images of around 700MB each, total of 2.1GB as one copy operation:
Windows XP SP2, NTFS, SATA: 1m17s @ ~20% CPU
Kubuntu Linux, EXT3, SATA: 2m40s @ 100% CPU
Kubuntu Linux, EXT3, PATA: 2m57s @ 100% CPU
That makes Windows XP *twice* as fast with only *one fifth* of the CPU usage!
I ran a further basic test on another machine I have running 64-bit Kubuntu and this appears to have pretty much the same issue. I'm not going to include the full spec of this at present as this report is already a bit spec-heavy; suffice to say it's an Athlon 64 X2 box with an nVidia chipset (SATA controller is CK804) using sata_nv. OS is Kubuntu Gutsy 64-bit.
There's something very wrong here. I haven't seen performance like this since the days when DMA wasn't enabled by default!