You are not logged in.

#1 2013-02-27 13:44:04

Lockheed
Member
Registered: 2010-03-16
Posts: 1,429

My system just won't use SWAP

I have everything configured. My swap is 2gb of size, swappiness is at 40, fstab is fine.

When I start running out of RAM memory, the system just becomes totally unresponsive, and yet the swap utilisation stays at 0%.

$ free
             total       used       free     shared    buffers     cached
Mem:       4052008    2746176    1305832          0     126492     965644
-/+ buffers/cache:    1654040    2397968
Swap:      2184188          0    2184188
# 
# /etc/fstab: static file system information
#
# <file system>        <dir>         <type>    <options>          <dump> <pass>
#devpts                 /dev/pts      devpts    defaults            0      0
#shm                    /dev/shm      tmpfs     nodev,nosuid        0      0

tmpfs                  /tmp          tmpfs     nodev,nosuid        0      0

/dev/sr0     /media/dvd   auto   ro,user,noauto,unhide   0      0

/dev/sda1 /mnt/Disk_D  ext4 defaults,noatime 0 2
/dev/sda2 / ext4 defaults,user_xattr,noatime 0 1
/dev/sda3 /mnt/win ntfs-3g     defaults,noatime,locale=en_US.utf8   0    0
/dev/sda5 none swap defaults 0 0

I am on systemd now, but it was the case since always, even before I moved.
Does anyone have any idea what could be wrong?


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#2 2013-02-27 17:07:03

s1ln7m4s7r
Member
Registered: 2013-02-22
Posts: 262

Re: My system just won't use SWAP

$ swapon /dev/sda5  ????????

Offline

#3 2013-02-27 17:32:09

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: My system just won't use SWAP

You could see if running the script from https://bbs.archlinux.org/viewtopic.php … 3#p1062643 (not right after booting) makes your system use swap.

Offline

#4 2013-02-27 19:43:42

Lockheed
Member
Registered: 2010-03-16
Posts: 1,429

Re: My system just won't use SWAP

I run the script and system became completely unresponsive, but swap did filled up to 300mb (out of 2gb).
I think it should prevent total unresponsivness and fill in larger proportion at swappiness 40. Or is it how it's supposed to be?


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#5 2013-02-27 20:56:43

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: My system just won't use SWAP

This is my take, which might not describe reality properly:

Low swappiness favours keeping programs in memory and dropping cache, high swappiness means swapping unused (least recently used) portions of programs in favour of cache. Programs can work properly with a big part of them swapped out. They also need cache. If the part of the program you want to access got swapped out or the program doesn't have the stuff it wants to use in cache, it needs to use the disk, hence one perceives a greater delay.

When you run the script, it continuously asks for more and more memory, it creates great memory pressure, so caches have to be dropped and least recently used parts of programs swapped out. Dropping cache is instantaneous, swapping out needs writing to the disk. Heavy swapping causes lack of responsiveness (light swapping out shouldn't be perceivable). How much swapping out occurs when running the script depends on how much the kernel deems viable for swapping out - the longer the system runs and the greater the amount of rarely used memory, the greater the amount that can be swapped out.

The output of your "free" shows more than 1 GB free - the kernel shouldn't worry about swapping out or dropping cache at that point, whatever the swappiness.

I prefer to have swappiness set to at least 60, so that unused portions of programs get slowly swapped out while my caches grow (my X takes 33 MB of my swap and 25 MB of my RAM at the moment).

Offline

#6 2013-02-27 21:58:48

Lockheed
Member
Registered: 2010-03-16
Posts: 1,429

Re: My system just won't use SWAP

I have 4GB ram and 2GB swap. The problem I run into is if I have Opera open with ~40 tabs, and then run a VirtualBox machine with dedicated 2gb ram, after few minutes systems becomes completely unresponsive because the RAM becomes full, but swap stays idling.

Is there some way to avoid it?


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#7 2013-02-27 22:22:06

elkoraco
Member
Registered: 2013-02-18
Posts: 121

Re: My system just won't use SWAP

Try to tune it up.

# sysctl -w vm.swappiness=x 

Swappiness takes a value between 1 and 100. The default is set to 60 or something. Maybe you decreased it somewhere (/etc/sysctl.conf is the relevant file). Try to up it to 90 or something. Refer to this page for an explanation: http://unixfoo.blogspot.com/2007/11/lin … uning.html

Last edited by elkoraco (2013-02-27 22:23:45)

Offline

#8 2013-02-27 23:35:15

Max-P
Member
Registered: 2011-06-11
Posts: 164

Re: My system just won't use SWAP

Are you sure you don't have enough memory and need to swap?

For me, even a 512 MB VM makes the system unresponsive even with 2 GB of RAM free, not because of swap or memory issues, but because the VM takes all the disk bandwidth. Especially a Windows VM. Other programs such as Chrome, Pidgin and a few others just freeze because they are waiting for some disk IO (Chrome for the cache/history/settings, Pidgin as soon as it touches its history, X because of xorg.log, etc). When the VM is done booting up, everything is fine again.

Increasing swapiness in your case might do the complete opposite effect you expect if I'm right. But I can be wrong too smile

Offline

#9 2013-02-28 11:38:09

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: My system just won't use SWAP

I don't really know what your system is doing when or after you start the VM. You can use "dstat -cdnpmgs --top-bio --top-cpu" to monitor what your system is doing, you can use "smem -kt" to see what is using swap.

If you're using 3 GB of RAM and then start a program which instantly demands 2 GB, then it has to swap out heavily to put that 1 GB in swap. Having a greater swappiness would mean it would be more likely to swap out before that great memory pressure starts. zram, zcache or zswap could make the system more responsive.

Offline

#10 2013-02-28 16:11:46

PaulBx1
Member
Registered: 2008-10-18
Posts: 142

Re: My system just won't use SWAP

Swap was a dodge created when memory was very expensive, there were many users for each computer, and much of computing was gigantic batch jobs, and cpus were running at 100% all the time. That's not the current situation for most of us. What I do when I am out of memory is run down to the store and buy more ram. I run with swap turned off; who needs all that thrashing about?

If you insist on running with swap, at least make sure it is on a very fast disk. Use a couple of SSDs and raid 0.

Last edited by PaulBx1 (2013-02-28 16:14:36)

Offline

#11 2013-02-28 18:26:19

Lockheed
Member
Registered: 2010-03-16
Posts: 1,429

Re: My system just won't use SWAP

PaulBx1 wrote:

Swap was a dodge created when memory was very expensive, there were many users for each computer, and much of computing was gigantic batch jobs, and cpus were running at 100% all the time. That's not the current situation for most of us. What I do when I am out of memory is run down to the store and buy more ram.

That surely would be the thing to do, except:
- I'm on DDR2 which is stupid-expensive
- laptops have usually restricted memory capacity, and although I could put 2x4GB ram into it, I'm not sure paying 100-200 bucks for it is worth it.

PaulBx1 wrote:

If you insist on running with swap, at least make sure it is on a very fast disk. Use a couple of SSDs and raid 0.

Again, not an option on laptops. Although I will place swap on SSD, when I get it.


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#12 2013-02-28 19:11:22

not_sure
Member
Registered: 2012-12-01
Posts: 25

Re: My system just won't use SWAP

Well, you still had about 1.2GB RAM free... what makes you think it should be swapping out?

I suggest you monitor CPU/RAM/HDD/SDD activity during your next slowdown.  htop, iotop

Offline

#13 2013-02-28 19:16:04

Lockheed
Member
Registered: 2010-03-16
Posts: 1,429

Re: My system just won't use SWAP

I have it on desktop in conky: CPU, RAM, Swap, so I do monitor it continuously.
I will return to it if it is still an issue.


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#14 2013-02-28 19:37:16

not_sure
Member
Registered: 2012-12-01
Posts: 25

Re: My system just won't use SWAP

Don't forget storage i/o smile

if you don't already -

${color grey}READ: ${color}$diskio_read  ${color grey}WRITE:  ${color}$diskio_write

Offline

#15 2013-02-28 19:53:40

Lockheed
Member
Registered: 2010-03-16
Posts: 1,429

Re: My system just won't use SWAP

@not_sure, thanks. Do you have something that shows the table of most frequently writing/reading programs in conky?

Last edited by Lockheed (2013-02-28 19:53:51)


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#16 2013-03-01 00:43:53

not_sure
Member
Registered: 2012-12-01
Posts: 25

Re: My system just won't use SWAP

Not for conky, but I suggest using iotop.

Offline

Board footer

Powered by FluxBB