WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [Xen-users] Calculate free memory

To: Xen-users@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-users] Calculate free memory
From: Eduardo Bragatto <eduardo@xxxxxxxxxxxx>
Date: Wed, 10 Aug 2011 13:24:24 -0300
Cc:
Delivery-date: Wed, 10 Aug 2011 09:25:34 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
I don't have Xen4 and therefore I was not able to reproduce your numbers, 
however with a little bit of thinking and a quick check on the manpages from 
"free" and "xm" you can understand what happens:

FREE(1)                       Linux User’s Manual                      FREE(1)

NAME
       free - Display amount of free and used memory in the system

Clearly "free" will only show you the memory from dom0 -- it will not show you 
the entire memory of you hardware. "free" doesn't even know if it's running on 
dom0 or domU. It's just a legacy tool that shows memory information from the OS 
(not from a hypervisor).

If "free" shows you you have "3456MB" total, "1090MB" used and "2365MB" free on 
dom0, that means that's the amount of memory dom0 has access to -- forget about 
domU at that point.

Whenever you launch a new domU, some memory from dom0 will be freed and 
allocated to the newly created domU (if you have "ballooning" enabled, which 
seems to be your case).

"xm info" on the other hand, is the tool used by Xen to provide information on 
how much memory has been allocated to dom0 and existing domUs, and how much 
memory is in fact available for new domU guests. From the manpage from "xm":

           free_memory
               Available memory (in MB) not allocated to Xen, or any other 
Domains.

You should read about memory ballooning and the reasons why you better not use 
it:

http://wiki.xensource.com/xenwiki/XenBestPractices

Best regards,
Eduardo Bragatto

On Aug 10, 2011, at 11:33 AM, Muriel wrote:

> Hi all,
> can be a stupid question, but there is a method to calculate the free
> memory in a system that counts also the memory reserved for the Dom0?
> I tried using xm info and free comand but there is something wrong.
> A simple example, host with 4 GB, kernel 2.6.32.39, xen 4.0.2,
> scientific linux 6:
> 
> --------------------------------------------
> xm info
> total_memory           : 4094
> free_memory            : 1046
> 
> free -m
> total       used       free     shared    buffers     cached
> 3456       1090       2365          0          8        127
> 
> So from "xm info" i have 3048 MB reserved, but 3456 are for dom0 (
> difference -408)
> ------------------------------------------
> 
> Now a system with 16GB, xen 4.1, centos 5:
> xm info:
> total_memory           : 16381
> free_memory            : 13633
> 
> free -m
> total       used       free     shared    buffers     cached
> 3072       2196        875          0        160        338
> 
> For xm info i have 2748 MB reserved, but 3072 are for dom0 (diff -324)
> If I set the dom0 memory but the difference between xm info data and
> free remain constant.
> ------------------------------------------
> 
> I have thought of memory reserved for the hypervisor, but then I tried
> with this configuration:
> host with 8GB, kernel 2.6.32.39, xen 4.0.2, scientific linux 6:
> xm info
> total_memory           : 8190
> free_memory            : 5006
> 
> free -m
> total       used       free     shared    buffers     cached
> 3072       2454        617          0        194        338
> 
> For xm info i have 3190 MB reserved, but 3072 are for dom0 (diff +112).
> ------------------------------------------
> 
> Someone can explain what happens?
> There is a simple and reliable way to get as much ram I have available for 
> domU?
> 
> Thanks,
> Muriel
> 
> _______________________________________________
> Xen-users mailing list
> Xen-users@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-users


_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

<Prev in Thread] Current Thread [Next in Thread>