# System slow while compiling

## kirikou

Hello! 

I have a problem with my system, each time I upgrade it or compile a new package, my system becomes to be unrespondant... (it took minutes to open epiphany, when I want to switch desktop, it tooks some seconds in order to redraw the desktop, ...)

I think it must be an error in my kernel configuration, but I was not able to find it....

Another error, that might be related, is that when I mount my external hard drive (160GB, whichi is almost full), it tooks minutes in order to be able to read it's content through nautilus (each time I wonder if nautilus has crashed or not).

Do you have any suggestion ? 

Thanks!

(I can post any file which might be needed, but I didn't know if it was useful to post my full .config...)

----------

## poly_poly-man

That's what compiling does... it's pretty cpu-intensive.

You _might_ find (experiment - YMMV) that there's a little speed lost in heat. I find occasionally that throttling my 3.0Ghz processor down to 2.25Ghz while cpu-intensive stuff is happening, I can get slight speed-ups.

Otherwise, suck it up, it probably means that your compile is using your cpu efficiently.

poly-p man

----------

## jexxie

If you'd like your compiles and emerging to sieze less of your computers hardware, you can enable the PORTAGE_NICENESS value in your /etc/make.conf

-19 is the highest priority you can set, and 19 is the lowest.  Setting your emerges around 15 or so, should give you a speedy system while you compile.

----------

## poly_poly-man

 *jexxie wrote:*   

> If you'd like your compiles and emerging to sieze less of your computers hardware, you can enable the PORTAGE_NICENESS value in your /etc/make.conf
> 
> -19 is the highest priority you can set, and 19 is the lowest.  Setting your emerges around 15 or so, should give you a speedy system while you compile.

 

... but slower compiles. Overall, it's nicer generally to lose your system for a few days (on a full world emerge, for example) than to lose it for longer while libraries upgrade before binaries, etc.

poly-p man

----------

## linga

Personally, I think it's better to be able to use my computer effectively even while compiling many packages, so I have set PORTAGE_NICENESS="19". If I want to raise the priority of portage I usually do that by running `sudo htop´ and adjusting from there.

Note though that you might not be able to use the computer all the time anyway, during extreme compiles (openoffice, eclipse-sdk assembly phase) unless you have lots of ram (around 2GB).

----------

## kirikou

Thanks for all your replies!! I will try to play with 

```
PORTAGE_NICENESS
```

!!

And for my other problem, do you have any suggestions (I thought it was related to my slowness during compile phase) ?

 *kirikou wrote:*   

> 
> 
> Another error, that might be related, is that when I mount my external hard drive (160GB, whichi is almost full), it tooks minutes in order to be able to read it's content through nautilus (each time I wonder if nautilus has crashed or not).

 

----------

## i92guboj

 *poly_poly-man wrote:*   

>  *jexxie wrote:*   If you'd like your compiles and emerging to sieze less of your computers hardware, you can enable the PORTAGE_NICENESS value in your /etc/make.conf
> 
> -19 is the highest priority you can set, and 19 is the lowest.  Setting your emerges around 15 or so, should give you a speedy system while you compile. 
> 
> ... but slower compiles. Overall, it's nicer generally to lose your system for a few days (on a full world emerge, for example) than to lose it for longer while libraries upgrade before binaries, etc.
> ...

 

First, higher niceness doesn't automatically mean that the compiler will run slow.

It just means that the compiler will have lesser priority that other tasks, in case both ask for a cpu time slice concurrently. The scheduler highly influences the concrete meaning of niceness. If the computer is iddle, then the compiler will run as ever, and will take the same to complete any task. If you are actually working on the computer, there is no point at all in working with an unusable system, so you definitely want higher niceness for portage tasks.

So, if you are using your pc, niceness is a good thing, and if you are away and the pc is iddle, niceness does almost nothing. I can't see where the problem lies.

Niceness doesn't automatically increase your compilation time. Even if you have a -19 niceness for portage (giving it the max priority) it will take hours to compile fvwm if you are running neverwinter nights on the while. It is YOU who slow down a compilation, and not your niceness value.  :Wink: 

----------

## i92guboj

 *kirikou wrote:*   

> 
> 
> Another error, that might be related, is that when I mount my external hard drive (160GB, whichi is almost full), it tooks minutes in order to be able to read it's content through nautilus (each time I wonder if nautilus has crashed or not).

 

It might just be a nautilus thing. If you can access ok from command line, then nautilus might be the culprit. It would help to know what filesystem are you using on that device. It might just be a fragmentation problem as well (not strange, if the drive is completely full).

----------

## kirikou

Effectively, I can access it without problem from the command line! I did not think about trying it!

The file system on my external hard drive is FAT32.

```
It might just be a fragmentation problem as well (not strange, if the drive is completely full).
```

Is there a way to refragment it correctly (in fact, what does it exactly means) ?

Thanks!

----------

## i92guboj

 *kirikou wrote:*   

> Effectively, I can access it without problem from the command line! I did not think about trying it!
> 
> The file system on my external hard drive is FAT32.
> 
> ```
> ...

 

If you can cd, ls and such without any noticeable delaly from the command line, then the problem is just about nautilus. Maybe it is opening the files for preview or to create thumbnails? That could explain the slow down to a certain degree. Note also that your usb drive might be using usb 1.1, which is even slower than 2.0. To check that, make sure you have ehci in your kernel. On dmesg you should see if the ehci driver is loaded or not. It could be that either your ports are not usb 2.0 capable, your drive is not 2.0 capable, or you don't have ehci on your kernel (or a combination of many of these factors).

Anyway, if you have enabled previews, it will be slow. And even if you don't use them, a fat32 filesystem will many thousands of files will always be slow to open on a graphical browser, overall if mounted in usb. fat32 scales really bad.

----------

## kirikou

Here are the last lines of dmesg (all that was about to my hard drive), EHCI seems to be used...

```
usb 1-1: new high speed USB device using ehci_hcd and address 4

usb 1-1: configuration #1 chosen from 1 choice

scsi0 : SCSI emulation for USB Mass Storage devices

usb-storage: device found at 4

usb-storage: waiting for device to settle before scanning

scsi 0:0:0:0: Direct-Access     SAMSUNG  SP1614N          TM10 PQ: 0 ANSI: 0

sd 0:0:0:0: [sda] 312581808 512-byte hardware sectors (160042 MB)

sd 0:0:0:0: [sda] Write Protect is off

sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00

sd 0:0:0:0: [sda] Assuming drive cache: write through

sd 0:0:0:0: [sda] 312581808 512-byte hardware sectors (160042 MB)

sd 0:0:0:0: [sda] Write Protect is off

sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00

sd 0:0:0:0: [sda] Assuming drive cache: write through

 sda:

sd 0:0:0:0: [sda] Attached SCSI disk

usb-storage: device scan complete
```

By doing so I noticed a strange line on dmesg :

```
cpufreqd[4328]: segfault at 8b0cec87 eip b7fe0699 esp bfe498c8 error 4
```

Do you think it might causes some slowdown ?

Thanks!

----------

## i92guboj

If i am not mistaken, that is the cpu frequency daemon. It has the potential to lower your cpu frequency and that would slow down the whole system, but I don't know if that is the case. I don't know if that segfaults are something normal when using that daemon, because I never used it for any purpose at all. Maybe someone else around knows a bit more about that and can help.

----------

## kirikou

Do you think that options in the kernel like the Preemption model (set to Voluntary Kernel Preemption in my kernel) and Timer frequency (set to 1000 HZ in my kernel) might cause some slowdown ?

My install is quite recent (2 months) and my previous installations worked better... (that's why I think I must have a problem in my kernel configuration!)

----------

## i92guboj

 *kirikou wrote:*   

> Do you think that options in the kernel like the Preemption model (set to Voluntary Kernel Preemption in my kernel) and Timer frequency (set to 1000 HZ in my kernel) might cause some slowdown ?
> 
> My install is quite recent (2 months) and my previous installations worked better... (that's why I think I must have a problem in my kernel configuration!)

 

Kernel preemption should be safe if you are using any recent kernel. Nothing stops you from compiling a new kernel with it disabled and see if that makes any difference, though... just in case.

About the timer, higher numbers are not always the best. It just means that the slices that the kernel uses to think are smaller, so you have a more fine grained control on how the time is shared amongst processes. That is fine if you really need that degree of interactivity. For example, if you need to record a sound source while playing another source and you want your input to be looped and directly mixed on your regular output. Such realtime tasks need an higher degree of responsivity, because every milisecond counts. But it causes also an overhead, since the kernel has to think about what he's going to do 1000 times per second, instead of just 250, for example. 

So, if you don't do any specialized real time task, I think that you should just recompile your kernel using a saner setting. I don't think it has anything to do with your problems, though.

----------

## linga

As long as cpufreqd is running it should not impact performance a lot since it highers the cpu frequency when its needed and lowers it when the computingpower is  not needed. If  it crashes then maybe you're stuck at the lowest frequency. I have never used cpufreqd either, I use the ondemand cpufreq governoor instead.

----------

## kirikou

I use the ondemand cpufreq governor too, but I thought that I need cpufreqd in order to "manage" the governor... is it not the case ?

And what is the purpose of cpufreq-utils (another cpu stuff I found in my rc-update (default runlevel)) ?

Thanks!

----------

## tarpman

 *kirikou wrote:*   

> I use the ondemand cpufreq governor too, but I thought that I need cpufreqd in order to "manage" the governor... is it not the case ?
> 
> And what is the purpose of cpufreq-utils (another cpu stuff I found in my rc-update (default runlevel)) ?
> 
> Thanks!

 

No.  ondemand manages itself; cpufreqd only controls your system when you're using the userspace governor.  cpufreq-utils is a utility that allows you to easily change which governor you're using, among other things.

----------

## kirikou

So there is no problem if I remove both (cpufreqd and cpufreq-utils) with rc-update del ? In fact, I can even un-merge them... ? Thanks!

----------

## boerKrelis

Is disk trashing amongst the symptoms?

If so, that might indicate excessive swapping, which would explain the unresponsiveness and I/O-problems. 

- Use 'top' to look for a high systemload, with 'kswapd' using lots of CPU-time

- Have a look at your memory status (free -m)

If necessary, adjust MAKEOPTS to "-j1", and move your swap to faster disks.

----------

## micmac

Do you by any chance use SATA AHCI and th CFQ IO scheduler? If so try if disabling NCQ helps: http://linux-ata.org/faq.html#ncq

----------

## energyman76b

 *poly_poly-man wrote:*   

>  *jexxie wrote:*   If you'd like your compiles and emerging to sieze less of your computers hardware, you can enable the PORTAGE_NICENESS value in your /etc/make.conf
> 
> -19 is the highest priority you can set, and 19 is the lowest.  Setting your emerges around 15 or so, should give you a speedy system while you compile. 
> 
> ... but slower compiles. Overall, it's nicer generally to lose your system for a few days (on a full world emerge, for example) than to lose it for longer while libraries upgrade before binaries, etc.
> ...

 

this is not true.

You even SHOULD set it to 19. Not 10 or 15, 19!

Why? Because tasks at 19 become batch-scheduled - and that is very good for compiling.

Btw, the OPs posters problem sounds like swap. Nautilus? So he is using gnome - and gnome is the desktop with the highest demand on memory. Gnome+emerge something = lots and lots of memory used. And swap is really slow....

----------

## kirikou

Thanks, I try the PORTAGE_NICENESS and it works wonderful!!

In effect, I'm using gnome.

I have 1G of RAM and even when I don't run emerge, my external hard drive take quite a lot of time to display folder (during this time I can't do anything with nautilus or it will crash).

----------

