# System unresponsiveness (especially during emerge)

## Silenzium

Hey there,

I have some problems with my laptop (HP Compaq nx8220 with Pentium M 1.733 GHz, 2GB RAM and a relatively new WDC WD2500BEVE hard drive) concerning responsiveness.

Some examples:

If processes like updatedb, trackerd (I thought it does not need lots of ressources) or emerge (PORTAGE_NICENESS=15) are running, I have interruptions during simple mp3 playback or flash videos. Sometimes the browser or other programs hang for some seconds. Surfing with Firefox is generally pretty slow during larger load.

Flash in general is quite slow and YouTube HD does not run smoothly at all.

I often do not have fluent movement with my bluetooth mouse, but my touchpad does not have those problems.

Playing Quake III Arena for example is not fluent as well, in spite of high frame rates.

When I plug in new USB devices, my system freezes for a short time.

I am running gentoo-sources-2.6.27-r8 and my harddrive uses ext3. The system is up-to-date (~x86 with some exception). I am not sure if those problems are maybe related to high CPU load and/or I/O-scheduling of the hard drive. Does anyone have an idea how to improve the situation? The hardware is not the newest and I don't know which of the problems are related to each other, but I think my system shouldn't be THAT unresponsive.

Here is my kernel config.

emerge --info

```

Portage 2.1.6.7 (default/linux/x86/2008.0/desktop, gcc-4.1.2, glibc-2.8_p20080602-r1, 2.6.27-gentoo-r8 i686)

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

System uname: Linux-2.6.27-gentoo-r8-i686-Intel-R-_Pentium-R-_M_processor_1.73GHz-with-glibc2.0

Timestamp of tree: Mon, 09 Mar 2009 11:15:02 +0000

ccache version 2.4 [enabled]

app-shells/bash:     3.2_p48-r1

dev-java/java-config: 2.1.7

dev-lang/python:     2.4.4-r15, 2.5.4-r2

dev-util/ccache:     2.4-r8

dev-util/cmake:      2.6.3

sys-apps/baselayout: 2.0.0

sys-apps/openrc:     0.3.0-r1

sys-apps/sandbox:    1.4

sys-devel/autoconf:  2.13, 2.63

sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2

sys-devel/binutils:  2.19.1

sys-devel/gcc-config: 1.4.1

sys-devel/libtool:   2.2.6a

virtual/os-headers:  2.6.28-r1

ACCEPT_KEYWORDS="x86 ~x86"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-O2 -march=pentium-m -pipe -fomit-frame-pointer"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"

CXXFLAGS="-O2 -march=pentium-m -pipe -fomit-frame-pointer"

DISTDIR="/usr/portage/distfiles"

FEATURES="ccache distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"

GENTOO_MIRRORS="http://mirror.gentoo.no ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo"

LANG="de_DE@euro"

LC_ALL="de_DE.UTF-8"

LDFLAGS="-Wl,-O1"

LINGUAS="de en en_GB en_US fr nb nb_NO"

MAKEOPTS="-j2"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/portage/layman/sunrise /usr/local/portage/layman/xwing /usr/local/portage"

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

USE="X a52 aac ace acl acpi alsa amr asf audiofile bash-completion berkdb bluetooth branding bzip2 cairo cdda cddb cdparanoia cdr cli cracklib crypt cups custom-cflags dbus directfb dri dts dvd dvdr dvdread dvi emboss encode esd evo exif fam fbcon fbcondecor ffmpeg firefox flac fortran freetype garmin gdbm gif gnuplot gnutls gphoto2 gpm gps gstreamer gtk hal iconv iptc ipv6 isdnlog jabber java jpeg latex ldap libnotify lirc lm_sensors mad matroska midi mikmod mmx mp3 mpeg mudflap musicbrainz ncurses nls nptl nptlonly nsplugin ogg opengl openmp pam pcre pdf perl pmu png postscript ppds pppd python qt3 qt3support qt4 quicktime rar raw readline realmedia reflection samba sdl session spell spl sse sse2 ssl startup-notification svg svga sysfs tcpd theora tiff truetype unicode usb v4l v4l2 vcd vorbis wifi win32codecs x264 x86 xfce xine xinerama xml xorg xscreensaver xulrunner xv xvid zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse synaptics evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de en en_GB en_US fr nb nb_NO" USERLAND="GNU" VIDEO_CARDS="fglrx vesa fbdev"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

hdparm -tT /dev/hda

```

/dev/hda:

 Timing cached reads:   1700 MB in  2.00 seconds = 849.81 MB/sec

 Timing buffered disk reads:  160 MB in  3.01 seconds =  53.11 MB/sec

```

----------

## startaq

 *Quote:*   

> CONFIG_GROUP_SCHED=y

 

Try to disable this, this solved the problem for me.

----------

## Silenzium

It improved a little bit, but during heavy HDD writing, the system is still very unresponsive. My bluetooth mouse has still sporadic interruptions.

----------

## Dammital

Try the deadline scheduler?

```
echo deadline > /sys/block/hda/queue/scheduler
```

----------

## Silenzium

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

noop anticipatory deadline [cfq]

```

What's the difference between "deadline" and the one I'm using?

----------

## Dammital

Short answer: I don't know!  (The details are easy enough to google.)

A year or so ago I noticed erratic response time under load with cfq.  Switched to deadline and I'm much happier now.  Whether this works for you depends on your load, your system, and a hundred variables.  Try it!

----------

## energyman76b

well, your config is full of stuff you certainly not need - seriously - math emulation? broken on smp? user_sched? seccomp?

loop? pktcdvd? do you really need that in kernel - instead of modules? Remember: smaller kernel = better kernel (uses less cache for itself) nfs? fat? you need that all the time? 

kernel hacking? you know that debug options slow everything down? try deactivating everything except unused symbols and magic sysrq keys there.

----------

## Silenzium

The help about seccomp says "If unsure, say Y. Only embedded should say N here." That's why I enabled it. 

What's "broken on smp"? I can't find it in "make menuconfig". (It says only that it's enabled, but there's no information where or what it is.)

----------

## energyman76b

the help text is misleading at best. It is only used by a pet project of Andrea Arcangeli - that almost nobody uses.

----------

## Silenzium

I tried to streamline my kernel with your tips and it's now about 300kb smaller. It feels a little bit faster, but I'll have to test further. I also give the deadline scheduler a try. Here's the modified config. If anyone has some more tips how to improve, please tell me.

Concerning flash videos, nothing improved. YouTube HD is still unusable for me, but I doubt this is a kernel related issue.

----------

## Dammital

 *Silenzium wrote:*   

> Concerning flash videos, nothing improved.

 

I notice that your nx8220 has an ATI Mobility Radeon X600 in it, and that you didn't specify "radeon" in make.conf (VIDEO_CARDS=).  You might add that, and then re-emerge your xorg-server.

----------

## Silenzium

I'm using fglrx which has a better 3D performance AFAIK.

----------

## Dammital

Right then, shows what I know.

Have you looked at the xorg log to verify that you're actually using fglrx?  The vesa driver is painfully slow on my system.  (Forgive me if I'm asking an obvious question.)

----------

## Dairinin

Silenzium, you are using PATA drive. Did you try

```
hdparm -u1 -B254 -W1 -m8 -c1 /dev/hda
```

?

----------

## Silenzium

Dammital, yes I'm using fglrx. Thanks anyway.

Dairinin, I'm currently using the following: -u0 (the manpage says it may cause massive filesystem corruption - is it save to active it with my system?) -B255 (my hard disk has too aggressive power management and spins down all the time, if I use lower numbers) -W1 -m16 (the manpage says WD recommends lower values, so I'll test it) -c0 (I'll check changing it).

P.S.: What's the best way of checking, if one of the flags improve performance?

----------

