1

I have a system without swap, and 16 GB of memory.

To my knowledge, Linux dynamically allocates the buffers memory allocation, depending on how much free RAM there is in the system.

In this very moment, this is the output of free -h:

              total        used        free      shared  buff/cache   available
Mem:            14G        2,2G         10G        336M        2,3G         10G
Swap:            0B          0B          0B

This means I would have 10 GB, plus around around 2 GB (buff/cache) which could be used if needed.

When I execute QEMU though, I can only specify up to 10G of RAM; is that correct? Is there anything I can do to make those 2 GB available?

Thanks.

2

I believe you might be experiencing issues due to free -h outputting rounded free space. Try checking it without -h and see exactly how many bytes you've got free, and set qemu to use something within that limit (give yourself a little space).

On another note I strongly recommend enabling swap space if you are trying to use all of your available RAM for a VM. Having swap is better than running out of RAM and hanging.

I'd leave as much free space as you possibly can, since disk swapping eats a lot of time.

(for anyone who visits this in the future: See http://www.linuxatemyram.com/ for why you should be able to use over 10 GiB. Buffer/cache area improves performance but is automatically freed when a program needs more RAM.)

  • You're right. I've done a more precise inspection of the memory (via free -m), and I in fact can use as much memory as there in in the available column. The linuxatemyram refence is not needed though :-) as the question already states that the buffers/cache memory should always be available if needed. – Marcus Aug 7 '16 at 13:56
0

Buffers/cache will grow as you use the system, unless the memory is needed for other purposes. These are used to improve performance, but space is release when memory is needed for other purposes.

It appears should be able to allocate up to 11 GB to QEMU, although I wouldn't without a swap file. With a sufficiently large swapfile you should be able to exceed 16GB allocated to QEMU. If your server becomes memory starved performance will suffer greatly.

The other important value is shared. If you have multiple virtual machines, QEMU may have some shared memory for its code. Only one copy of shared memory is required no matter how many processes use it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.