qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] why guest memory size not equal to my setting?


From: Paolo Bonzini
Subject: Re: [Qemu-devel] why guest memory size not equal to my setting?
Date: Mon, 12 Jun 2017 14:46:56 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0

On 10/06/2017 15:54, ??6????A wrote:
> Hello Qemu-devel,
> 
> Recently I'm trying to study vm memory allocation on qemu-kvm environment.
> I found some interesting here:
> 
> I have create a 8GB(8388608 k) memory guest using Centos 7. but when I using 
> dmesg to show the init memory,
> it was 9437184 k,around 9216MB. I would like to know the gap?

> I know qemu will init two memory region:
> system_memory = g_malloc(sizeof(*system_memory));
> and system_io = g_malloc(sizeof(*system_io));
> 
> Does those gap point to the region of system_io ?

No, these are two different address spaces.  Guest RAM is allocated by
memory_region_allocate_system_memory as a single region of the size you
specified.

The guest memory map doesn't place all the memory contiguously.  For the
"pc" machine type, from 3GB to 4GB there is a hole for memory mapped
registers of PCI devices.  Linux reports this hole as "absent" memory:

[    0.000000] Memory: 7372140k/9437184k available (6244k kernel code,
1049100k absent, 1015944k reserved, 4178k data, 1604k init)

Note that Linux 3.11 or newer doesn't report absent pages anymore
(commit 46a841329a6c, "mm/x86: prepare for removing num_physpages and
simplify mem_init()", 2013-07-03).

Thanks,

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]