From: Paolo Bonzini <pbonzini@redhat.com>
To: 男6龙双A <5019096@qq.com>, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] why guest memory size not equal to my setting?
Date: Mon, 12 Jun 2017 14:46:56 +0200 [thread overview]
Message-ID: <cc7b29f5-b6d1-8ac9-187d-abe77b6b0beb@redhat.com> (raw)
In-Reply-To: <tencent_7AD3D98771C01E340454EDB8@qq.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 1235 bytes --]
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
prev parent reply other threads:[~2017-06-12 12:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-10 13:54 [Qemu-devel] why guest memory size not equal to my setting? =?gb18030?B?xNA2wfrLq0E=?=
2017-06-12 12:46 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cc7b29f5-b6d1-8ac9-187d-abe77b6b0beb@redhat.com \
--to=pbonzini@redhat.com \
--cc=5019096@qq.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).