100% CPU usage during disk I/O with SATA/PATA

Bug #192353 reported by Gordon Mckeown on 2008-02-16
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux-meta (Ubuntu)
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 -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 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 -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 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

Gordon Mckeown (thefluffyone) wrote :

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!

Gordon Mckeown (thefluffyone) wrote :

Modified the bug title since this does seem to affect serial *and* parallel ATA.

Gordon Mckeown (thefluffyone) wrote :

Have taken advise from the LKML and the IOWait figures are considered normal -- they indicate the time the CPU spends idle waiting for IO. Other processes can make use of these idle cycles, so although the CPU appears pegged at 100% it does in fact still have available cycles.

Gordon Mckeown (thefluffyone) wrote :

Marked as invalid as it's not a bug.

Changed in linux-meta:
status: New → Invalid
Samael (samael28) on 2008-08-30
Changed in linux-meta:
status: Invalid → Incomplete
Samael (samael28) wrote :

It's not an Ubuntu bug. It's linux-kernel hdd drivers bug.

Dell Inspiron 1501. AMD Sempron 3500+, Fujitsu 80 GB HDD, SATA.

 hdparm /dev/sda
/dev/sda:
 IO_support = 0 (default)
16-bit)
 HDIO_GET_UNMASKINTR failed: Inappropriate ioctl for device
 HDIO_GET_DMA failed: Inappropriate ioctl for device
 HDIO_GET_KEEPSETTINGS failed: Inappropriate ioctl for device

Just as you see, DMA support failed.

Gordon Mckeown (thefluffyone) wrote :

Well, no, in my case it wasn't a bug; it was a quirk of the way CPU usage is reported. I would suggest you have a different issue, since DMA was working fine for me as you can see from my hdparm output above.

Duane Hinnen (duanedesign) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. You reported this bug a while ago and there hasn't been any activity in it recently. We were wondering if this is still an issue for you. Can you try with the latest Ubuntu release? Thanks in advance.

Duane Hinnen (duanedesign) wrote :

We are closing this bug report because it lacks the information we need to investigate the problem, as described in the previous comments. Please reopen it if you can give us the missing information, and don't hesitate to submit bug reports in the future. To reopen the bug report you can click on the current status, under the Status column, and change the Status back to "New". Thanks again!

Changed in linux-meta (Ubuntu):
status: Incomplete → Invalid
misoa (miso-arbutina) wrote :

I am having the same problem,along with few other people i know.
I have amd barton 1830Mhz,512MB memory and nforce2 board with Silicon 3112 Sata controler chip,160gb SATA drive. I had this problem with ubuntu 9.04 and now with a fresh install of Xubuntu 9.10
I am new to using linux,i installed few programs as ntfs-3g,ntfs config,storage device manager.
As I see there is no solution for this problem.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers