4

I experience from time to time when I'm working heavily, that my systems (Ubuntu 13.10) freezes. Syslog says, that a process had to be killed to to memory shortage.

Killed process 4693 (chromium-browse) total-vm:1386284kB, anon-rss:31688kB, file-rss:3424kB

That happens even if my swap is pretty much empty. I do have 4GB RAM and 4GB Swap partition.

Top says:

KiB Mem:   3932056 total,  2828880 used
KiB Swap:  4079612 total,   332492 used,

So plenty of room available. But then I found out, that some processes are not using swap at all. They seem to eat all my physical RAM without even considering swapping some pages to disk. I used "top"'s SWAP column to verify SWAP usage per process.

These are e.g. Chromium web browser and VirtualBox. Others, like Firefox, Netbeans, etc. are swapping.

So who "decides" what process is swapping and which not? From my understanding, this is done by the kernel, because from application perspective memory is memory without distinguishing between swap and physical RAM. Is that true or do the Chromium developer have the application set to only use physical RAM?

Thanks for your help!

3
  • Sounds as if you have a bug, and to be honest it can get complicated with virtualization. See - linuxjournal.com/article/10678
    – Panther
    Mar 21, 2014 at 17:44
  • Thanks, that's interesting. I try that. But just to be clear: I have troubles with memory on the VirtualBox host, not the virtual machines.
    – Tim
    Mar 21, 2014 at 21:31
  • I understand. I use KVM and openvz and have not used virtualbox in years. If the problem seems to only occur when you are running virtualbox I would presume it is somehow in the way the virtualbox kernel module is allocating memory. I would suggest you post on the virtual box forums.
    – Panther
    Mar 21, 2014 at 21:34

2 Answers 2

1

I think your "problem" is with VirtualBox.

According to the VirtualBox Manual

Base memory

This sets the amount of RAM that is allocated and given to the VM when it is running. The specified amount of memory will be requested from the host operating system, so it must be available or made available as free memory on the host when attempting to start the VM and will not be available to the host while the VM is running.

I found similar comments on the VirtualBox forums (although they were not as helpful).

See: https://forums.virtualbox.org/viewtopic.php?f=2&t=50179

So I am guessing the virtualbox kernel module allocates free memory to the guest but is not polite enough to inform the host. Thus when you look at free RAM (with tools such as free -m) you appear to have sufficient memory BUT ... because the kernel module does not inform the host OS, the host can not appropriately manage swap, and your applications then crash doe to a lack of memory (free or swap).

I would suggest you file a bug report, but, I am guessing it would be closed as "won't fix"

From the thread on the VirtualBox forums linked in Tim's comment:

To answer your question as to if VBox can or can not use swap, no, nothing but the operating system can do that. Swap is not memory that is actually usable.

1
0

The Linux kernel "decides" that. It does so with a tunable parameter called swappiness.

2
  • OK, I tried that. But even with swappiness=100 processes like VirtualBox won't be swapped either.
    – Tim
    Mar 21, 2014 at 21:28
  • @Tim Regardless, as you alluded in your question user mode code cannot control swap; the Linux kernel manages your system's memory (physical and virtual). Mar 21, 2014 at 23:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .