# 100% CPU utilization during IDE operations

## Caleb_CZ

I have big problem with my gentoo (2004.2). If type cat /big_file /tmp (or cat /big_file /dev/null) , top give me this:

```
Tasks:  70 total,   1 running,  68 sleeping,   0 stopped,   1 zombie

Cpu(s): 13.1% us, 11.4% sy,  0.0% ni,  0.0% id, 73.8% wa,  1.7% hi,  0.0% si

```

The machine does get very unresponsive. 

hdparm -i /dev/hda

```
Model=TOSHIBA MK6026GAX, FwRev=PA202G, SerialNo=Z4B82710S

 Config={ Fixed }

 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=48

 BuffType=unknown, BuffSize=0kB, MaxMultSect=16, MultSect=16

 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=117210240

 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}

 PIO modes:  pio0 pio1 pio2 pio3 pio4 

 DMA modes:  sdma0 sdma1 sdma2 mdma0 mdma1 mdma2 

 UDMA modes: udma0 udma1 *udma2 udma3 udma4 udma5 

 AdvancedPM=yes: unknown setting WriteCache=enabled

 Drive conforms to: device does not report version: 

```

hdparm /dev/hda

```
 multcount    = 16 (on)

 IO_support   =  3 (32-bit w/sync)

 unmaskirq    =  1 (on)

 using_dma    =  1 (on)

 keepsettings =  0 (off)

 readonly     =  0 (off)

 readahead    = 256 (on)

 geometry     = 65535/16/63, sectors = 117210240, start = 0

```

And my kernel-config

http://sweb.cz/Spacil.Ondrej/ATA.png

I have i440 BX chipset (Dell Latitude CPi A366XT)

I'm using gentoo-2.6.9-sources. I tried 2.6.10-mm and 2.6.10-ck without any effect. 

Tnx and sorry for my english.Last edited by Caleb_CZ on Fri Feb 18, 2005 12:01 am; edited 2 times in total

----------

## jwj

The hdparm output looks ok. Does your hd require the Use multi-mode by default kernel option?

Edit: I am not sure if the IO_support = 3 might be the problem either. Have you tried setting this to 1?Last edited by jwj on Wed Feb 02, 2005 4:10 pm; edited 1 time in total

----------

## SimonKellett

 *Caleb_CZ wrote:*   

> 
> 
> Cpu(s): 13.1% us, 11.4% sy,  0.0% ni,  0.0% id, 73.8% wa,  1.7% hi,  0.0% si
> 
> 

 

That looks OK to me: 73.8% time spent waiting for the disk I/O. I guess the machine is unresponsive because any task that needs to look at the disk is going to join the queue during you big copy.

----------

## Caleb_CZ

 *jwj wrote:*   

> 
> 
> Edit: I am not sure if the IO_support = 3 might be the problem either. Have you tried setting this to 1?

 

I tried all combination ... no effect  :Sad: 

 *jwj wrote:*   

> 
> 
> The hdparm output looks ok. Does your hd require the Use multi-mode by default kernel option? 

 

I will try disable Use multi-mode by default and i also will try 2.4.x kernel.

----------

## Caleb_CZ

 *SimonKellett wrote:*   

>  *Caleb_CZ wrote:*   
> 
> Cpu(s): 13.1% us, 11.4% sy,  0.0% ni,  0.0% id, 73.8% wa,  1.7% hi,  0.0% si
> 
>  
> ...

 

Mouse cursor is jerky during file copy, audio player stop playing etc. This is not normal.

----------

## jwj

What is the output of

```

cat /proc/interrupts

```

----------

## Caleb_CZ

```
           CPU0       

  0:   21465334          XT-PIC  timer

  1:      34040          XT-PIC  i8042

  2:          0          XT-PIC  cascade

  5:     628523          XT-PIC  NM256AV

  9:          1          XT-PIC  acpi

 11:    1307523          XT-PIC  yenta, yenta, uhci_hcd, 3c589_cs

 12:         77          XT-PIC  i8042

 14:     510991          XT-PIC  ide0

NMI:          0 

ERR:        298

```

----------

## thebigslide

Do you have the I/O APIC option turned on in the kernel?  Try recompiling the kernel w/o APIC support at all.

----------

## kmare

actually I have the same issue, 100% cpu usage while having I/O operations with the disk. Everything looks ok. At first I thought it was a reiserfs prob. So I tried different options. The prob is still there... then I tried with a fat32 a partition. Same problem... so maybe is kernel configuration problem? or maybe hardware? I have a nforce2ultra chipset on my motherboard.

can anybody help? thanx...

----------

## Caleb_CZ

 *thebigslide wrote:*   

> Do you have the I/O APIC option turned on in the kernel?  I tried recompiling the kernel w/o APIC support at all.

 

My hardware does not support APIC. I tried turn on manualy, but dmesg say me, that there is no APIC support in my hardaware. So .. i can try again.

----------

## thebigslide

Here's my advice.

Boot a knoppix CD and mount your drives.  See if there's the same problem with that kernel.

if yes, 

1)  Do you have the latest motheboard bios?

2)  Maybe try -Xmdma2 instead of -Xudma2 in hdparm.

3)  drive termination: are your drives jumpered for master/slave properly?  Remember, masters/singles go on the end of the cable for best signal termination and performance. Some drives(esp optical drives)  are also pickey as to whether they're master or slave, maybe try swapping them.  

4)  Try the 2.4.20 kernel 

If no,

1)  Compile a different kernel, try a very stable release and patch to eliminate the possibility of a driver issue.  Try with and without the nvidia/intel module inserted.

3) do an 

```
emerge -e system&&emerge -e system
```

 with less aggressive CFLAGS and USE flags.

----------

## Caleb_CZ

 *thebigslide wrote:*   

> Here's my advice.
> 
> Boot a knoppix CD and mount your drives.  See if there's the same problem with that kernel.
> 
> 

 

I tried Gentoo LiveCD 2002.2 (2.4.26) and the problem is gone. Top in Gentoo LiveCD hasn't "wasted" cell, but during copy, it was about 80% CPU in the Idle.

What's wrong with 2.6.x kernel??

 *thebigslide wrote:*   

> 1)  Do you have the latest motheboard bios?
> 
> 

 

Yes

 *thebigslide wrote:*   

> 2)  Maybe try -Xmdma2 instead of -Xudma2 in hdparm.
> 
> 

 

No effect

 *thebigslide wrote:*   

> 3)  drive termination: are your drives jumpered for master/slave properly?  Remember, masters/singles go on the end of the cable for best signal termination and performance. Some drives(esp optical drives)  are also pickey as to whether they're master or slave, maybe try swapping them.  
> 
> 

 

I have only one 2.5" HDD in my notebook. It hasn't jumper, but i guess it's Master.

 *thebigslide wrote:*   

> 4)  Try the 2.4.20 kernel 
> 
> 

 

Yes, 2.4.x kernel works fine, but i want use 2.6.x kernel. (Alsa, I8k etc. - yes, i can do the same with modules   :Confused:  )

I will try some 2.6.x live distrubution ....

----------

## thebigslide

Well, that narrows it down.  It's not hardware.  Drop your cflags to

```
CFLAGS="-O2 -mcpu=whatever -pipe"
```

 and reemerge sys-apps/procps.  Also, please post the output of 

```
emerge info
```

 and let us know if you are using udev or devfs.

----------

## Caleb_CZ

I'm using default device filesystem of gentoo 2004.2 - devfs.

and ... emerge info:

```
Gentoo Base System version 1.4.16

Portage 2.0.51-r13 (default-linux/x86/2004.3, gcc-3.4.3, glibc-2.3.3.20040420-r0, 2.6.9-gentoo-r1 i686)

=================================================================

System uname: 2.6.9-gentoo-r1 i686 Mobile Pentium II

Python:              dev-lang/python-2.3.3-r1 [2.3.3 (#1, Jul 11 2004, 19:39:29)]

ccache version 2.3 [enabled]

dev-lang/python:     2.3.3-r1

sys-devel/autoconf:  2.59-r3

sys-devel/automake:  1.8.3

sys-devel/binutils:  2.14.90.0.8-r1

sys-devel/libtool:   1.4.3-r4

virtual/os-headers:  2.6.8.1-r1

ACCEPT_KEYWORDS="x86 ~x86"

AUTOCLEAN="yes"

CFLAGS="-O2 -mcpu=i686 -pipe"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config"

CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"

CXXFLAGS="-O2 -mcpu=i686 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"

GENTOO_MIRRORS="ftp://ftp.sh.cvut.cz/MIRRORS/gentoo/gentoo http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ "

MAKEOPTS="-j2"

PKGDIR="/usr/portage/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/portage"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="X aalib acpi acpi4linux alsa apm avi beepmp berkdb bitmap-fonts bmp cdparanoia cdrom codecs crypt cups directfb divx4linux encode f77 fam ffmpeg flac font-server foomaticdb fortran freetype gdbm gif gnome gpm gtk gtk2 imlib ipv6 java jpeg ldap libg++ libwww mad mikmod mmx mozilla mpeg mplayer nas ncurses nls oggvorbis oss pam pcmcia pdflib perl png python quicktime readline samba sdl slang spell ssl svga tcpd tiff truetype truetype-fonts type1-fonts x86 xml xml2 xmms xv zlib"

Unset:  LDFLAGS

 
```

----------

## thebigslide

 *Quote:*   

> ACCEPT_KEYWORDS="x86 ~x86"

  Is using testing packages on your system.  That might be part of it....

----------

## Caleb_CZ

So i finally tried Knoppix with 2.6.9 and 2.4.26 kernels.

With 2.6.9 => 90% wasted

With 2.4.26 => 80% idle

during file copy.

I will use 2.4.x kernel until someone fix this problem   :Confused: Last edited by Caleb_CZ on Fri Feb 18, 2005 12:09 am; edited 1 time in total

----------

## balinares

What is the output of

```
dmesg | grep -i scheduler
```

and

```
cat /sys/block/hda/queue/scheduler
```

...?

IO schedulers are kernel options defined in Device Drivers > Block Devices > IO Schedulers.

In my current kernel (2.6.10-gentoo-r6), there are three of those: anticipatory, CFQ and deadline. Anticipatory is the default. Unfortunately, it seems to KILL the box when performing intense operations (typically, uncompressing a large .tar.bz2). That might be your problem. Compile in the CFQ scheduler, and add

```
elevator=cfq
```

to your kernel configuration in GRUB. Does this help? CFQ is a scheduler meant to share IDE access fairly between processes, which is MUCH nicer for a desktop.

----------

## SimonKellett

 *balinares wrote:*   

> 
> 
> That might be your problem. Compile in the CFQ scheduler, and add
> 
> ```
> ...

 

I have not tried it but you can switch on the fly if you have all 3 schedulars built in :

```
echo cfq|anticipatory|deadline > /sys/block/hd?/queue/scheduler
```

and you can see what is being used with:

```
cat /sys/block/hd?/queue/scheduler
```

----------

## tablet

I am having  the exactly same problems as described in this thread. When extracting large archives the computer slows to crawl, mouse becomes extremely sluggish. This occurs in both GNOME and KDE.

Switching disk scheduler as described above has not helped in my case  :Sad:  I am just compiling 2.4 kernel to try that instead of 2.6.x.

----------

## Caleb_CZ

 *balinares wrote:*   

> What is the output of
> 
> Compile in the CFQ scheduler, and add
> 
> 

 

I already tried this, of course effect is equal to zero   :Sad: 

----------

## thebigslide

Let's see what happens if you install the 2.4.26 sources and .config that the knoppix CD used.  Just to make sure it's the kernel.  There are a lot of variables that can add up to your condition.

----------

## Fox!MURDER

got similar problem with 2.6

its pentium 3 600MHz, i440BX, IBM hdd ... 

i found a thread someplace describing the slowdown of IDE in kernel 2.5.60. the guys over there had about 20MB/s with 2.5.59 and 15MB/s with 2.5.60 and they were also complaining about high cpu load. 

i don really want to try 2.4 because of glibc and other issues, so i keep looking for 2.6 solution ...

----------

