From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXXfR-0000iW-JF for qemu-devel@nongnu.org; Fri, 26 Sep 2014 11:42:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXXYY-0003je-Hq for qemu-devel@nongnu.org; Fri, 26 Sep 2014 11:36:06 -0400 Received: from mail-we0-x231.google.com ([2a00:1450:400c:c03::231]:41604) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXXYY-0003hm-9J for qemu-devel@nongnu.org; Fri, 26 Sep 2014 11:35:38 -0400 Received: by mail-we0-f177.google.com with SMTP id t60so9811428wes.36 for ; Fri, 26 Sep 2014 08:35:32 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <542587C1.2070809@redhat.com> Date: Fri, 26 Sep 2014 17:35:29 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1411468944-10784-1-git-send-email-zhang.zhanghailiang@huawei.com> <5425253C.3070700@huawei.com> In-Reply-To: <5425253C.3070700@huawei.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] vl: Adjust the place of calling mlockall to speedup VM's startup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang , qemu-devel@nongnu.org Cc: imammedo@redhat.com, mst@redhat.com, luonengjun@huawei.com, peter.huangpeng@huawei.com, hutao@cn.fujitsu.com Il 26/09/2014 10:35, zhanghailiang ha scritto: > Hi, > > This has been reviewed, Will anyone pick this up?;) I think mst will. It's Jewish new year this week, so it will have to wait for next week. Paolo > Thanks, > zhanghailiang > On 2014/9/23 18:42, zhanghailiang wrote: >> 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 >> Signed-off-by: zhanghailiang >> --- >> v2: >> - Add Acked-by >> - change 'int' to 'bool' (Thanks Hu Tao) >> --- >> vl.c | 11 +++++------ >> 1 file changed, 5 insertions(+), 6 deletions(-) >> >> diff --git a/vl.c b/vl.c >> index dc792fe..35e5de6 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"); >> @@ -3973,7 +3970,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); >> @@ -4441,6 +4438,8 @@ int main(int argc, char **argv, char **envp) >> >> machine_class->init(current_machine); >> >> + realtime_init(); >> + >> audio_init(); >> >> cpu_synchronize_all_post_init(); >> > > > >