From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
zhanghailiang <zhang.zhanghailiang@huawei.com>,
Anthony Liguori <aliguori@amazon.com>
Subject: [Qemu-devel] [PULL 5/5] vl: Adjust the place of calling mlockall to speedup VM's startup
Date: Tue, 30 Sep 2014 12:40:14 +0300 [thread overview]
Message-ID: <1412069893-4717-6-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1412069893-4717-1-git-send-email-mst@redhat.com>
From: zhanghailiang <zhang.zhanghailiang@huawei.com>
If we configure mlock=on and memory policy=bind at the same time,
It will consume lots of time for system to treat with memory,
especially when call mbind behind mlockall.
Adjust the place of calling mlockall, calling mbind before mlockall
can remarkably reduce the time of VM's startup.
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
vl.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/vl.c b/vl.c
index dbdca59..9d2aaaf 100644
--- a/vl.c
+++ b/vl.c
@@ -134,6 +134,7 @@ const char* keyboard_layout = NULL;
ram_addr_t ram_size;
const char *mem_path = NULL;
int mem_prealloc = 0; /* force preallocation of physical target memory */
+bool enable_mlock = false;
int nb_nics;
NICInfo nd_table[MAX_NICS];
int autostart;
@@ -1421,12 +1422,8 @@ static void smp_parse(QemuOpts *opts)
}
-static void configure_realtime(QemuOpts *opts)
+static void realtime_init(void)
{
- bool enable_mlock;
-
- enable_mlock = qemu_opt_get_bool(opts, "mlock", true);
-
if (enable_mlock) {
if (os_mlock() < 0) {
fprintf(stderr, "qemu: locking memory failed\n");
@@ -3974,7 +3971,7 @@ int main(int argc, char **argv, char **envp)
if (!opts) {
exit(1);
}
- configure_realtime(opts);
+ enable_mlock = qemu_opt_get_bool(opts, "mlock", true);
break;
case QEMU_OPTION_msg:
opts = qemu_opts_parse(qemu_find_opts("msg"), optarg, 0);
@@ -4442,6 +4439,8 @@ int main(int argc, char **argv, char **envp)
machine_class->init(current_machine);
+ realtime_init();
+
audio_init();
cpu_synchronize_all_post_init();
--
MST
next prev parent reply other threads:[~2014-09-30 9:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-30 9:39 [Qemu-devel] [PULL 0/5] pci, pc, virtio, misc bugfixes Michael S. Tsirkin
2014-09-30 9:40 ` [Qemu-devel] [PULL 1/5] loader: g_realloc(p, 0) frees and returns NULL, simplify Michael S. Tsirkin
2014-09-30 9:40 ` [Qemu-devel] [PULL 2/5] Revert "virtio-pci: fix migration for pci bus master" Michael S. Tsirkin
2014-09-30 9:40 ` [Qemu-devel] [PULL 3/5] pci-hotplug-old: avoid losing error message Michael S. Tsirkin
2014-09-30 9:40 ` [Qemu-devel] [PULL 4/5] pc-dimm: Don't check dimm->node when there is non-NUMA config Michael S. Tsirkin
2014-09-30 9:40 ` Michael S. Tsirkin [this message]
2014-09-30 13:59 ` [Qemu-devel] [PULL 0/5] pci, pc, virtio, misc bugfixes Peter Maydell
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=1412069893-4717-6-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=aliguori@amazon.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=zhang.zhanghailiang@huawei.com \
/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).