# [SOLVED] Extensive swappiness even when RAM is unutilized

## drseergio

Before I ask the question I must say that I have crawled all of the forums and resources I could but there is no reasonable explanation for what is happening with my machine.

I have 2G of RAM and 2G of swap. The problem is that swap gets used even if RAM is not filled up. For example, only 700/2048Mb of RAM is used when 600+Mb/2G of SWAP gets used as well. That would be ok if the system would not hang. I can't see dmesg, top or anything else, and only the MagicKey helps. The HDD is used as hell.

I am using vanilla 2.6.30, the problem was present in 2.6.29 as well.

Nothing interesting is seen in dmesg. Perhaps this is a known a problem. Is there something I can include to diagnose the source of the problem? Anyone has any ideas of what might be wrong?Last edited by drseergio on Mon May 25, 2009 5:48 am; edited 1 time in total

----------

## coolsnowmen

Hang?! What are you doing?

Using swap when 'unnecessary' will slow operations down, but not hang.  If you want to remove swap from the diagnosis, than do just that.  2Gb of ram should get you through the day until you can prove whether or not swap is affecting your hanging problem.

----------

## drseergio

Right. As an experiment I'll turn off the swap to see if the problem remains. It slows down to a standstill, sometimes I can see the last moments see conky which shows load average of 16 (!). The last time I was using NetBeans when that happened.

----------

## LoSeR_5150

what does 

```
 cat /proc/sys/vm/swappiness
```

show?  

I usually set mine at 1 if I have more than 2GB of ram... mileage may vary so try some adjustments and see what works best.

You can specify your swapiness level in you /etc/sysctl.conf 

just append 

```
#Configure Swappiness

vm.swappiness = 5
```

to the end of your /etc/sysctl.conf

or you an just echo in variables to /proc/sys/vm/swappiness ... hope this helps.

----------

## drseergio

 *LoSeR_5150 wrote:*   

> what does 
> 
> ```
>  cat /proc/sys/vm/swappiness
> ```
> ...

 

I used to have 0 there, at the moment it's set to default. However, I suppose even in such a case it should not bring a system to a halt.

Continuing with the experiment turning swap off did not help. The system goes wild when (!) 500Mb of 2G is used. The last thing I notice is the 15Mb/s disk access and kswap0 in the process table. This seems highly related to the fact I run NetBeans, though closing it and opening it does not help.

I'll try to set swappiness to 1 and see if that helps.

----------

## MaximeG

Hi,

Perhaps NetBeans is limited to xxx amount of memory by its configuration ?

I had same kind of issue with virtual machines, or graphics program in which the allocated memory I gave them was too small.

Regards,

Maxime

----------

## drseergio

Interesting observations - when this occurs some kind of memory corruption takes place, which is noticeable by strange fonts in applications. For example, in Firefox I get gibberish fonts. Also, restarting X helps.

Perhaps this is a more related X-related issue?

----------

## jcat

Couple of things.

Have you tried a memtest?  Not 100% reliable, but it may throw some light on a potential issue with your RAM.

Also, have you double checked your high memory settings in the kernel?

Cheers,

jcat

----------

## drseergio

 *jcat wrote:*   

> Couple of things.
> 
> Have you tried a memtest?  Not 100% reliable, but it may throw some light on a potential issue with your RAM.
> 
> Also, have you double checked your high memory settings in the kernel?
> ...

 

I'll run the memtest just to be sure.

What is it exactly about the high memory settings in the kernel I should check? Is it CONFIG_HIGHPTE? Is it  CONFIG_HIGHMEM64G (I have high mem support set to 4G as recommended for machines with >=1G ram)?

----------

## eccerr0r

Sure your apps are not really using up all your RAM?

Run 'top' in another xterm and watch it.  Might want to sort it by 'M'emory.

As the machine starts running out of RAM you can watch it in top...  See if this is happening or not.

If you're getting corruption as you run out of ram...also make sure your disk i/o system is error free...

----------

## drseergio

I think I have discovered the culprit of this behavior. The same problem has been observed on my friend's computer who is running a similar but still different configuration. The common part is the X-Server 1.6 and Intel driver 2.7. If one looks at X in the process table when that happens he'll see more than 1G of virtual memory occupied.

The reason why he did not experience these problems earlier probably lies in the fact that his machine has twice as much of RAM. On the other hand, NetBeans and UI development (which I am currently occupied with) greatly accelerate the X in its memory consumption trends.

----------

