From: Paolo Bonzini <pbonzini@redhat.com>
To: Zhanghailiang <zhang.zhanghailiang@huawei.com>
Cc: "edgar.iglesias@xilinx.com" <edgar.iglesias@xilinx.com>,
"kwolf@redhat.com" <kwolf@redhat.com>,
"quintela@redhat.com" <quintela@redhat.com>,
"libvir-list@redhat.com" <libvir-list@redhat.com>,
Stefan Hajnoczi <stefanha@gmail.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"Huangpeng (Peter)" <peter.huangpeng@huawei.com>,
Huangzhichao <huangzhichao@huawei.com>,
Huazhiqiang <huazhiqiang@huawei.com>
Subject: Re: [Qemu-devel] [RFC] support memory reserved feature and optimize mlock guest memory propose
Date: Thu, 06 Mar 2014 09:41:40 +0100 [thread overview]
Message-ID: <531834C4.3070609@redhat.com> (raw)
In-Reply-To: <D1BD20B5DB34024DA951CEEE6C4C599859619834@szxema505-mbs.china.huawei.com>
Il 06/03/2014 09:06, Zhanghailiang ha scritto:
>
>> Il 05/03/2014 09:01, Zhanghailiang ha scritto:
>>> Hi all:
>>>
>>> Currently, we use cgroup(memory) to support memory QoS on KVM
>>> platform, and use "mlock" on qemu to support "memory reserved".
>>>
>>> The "mlock" seems to be not appropriate.
>>>
>>> Now qemu "mlock" memory in the main thread, which would lock iothread
>>> (qemu_mutex_lock_iothread), if the memory size is large, that will
>>> consume lots of time.
>>>
>>> It means whenever we want to set a new 'mlock', the VM would be
>>> blocked for a while.
>>
>> I'm not sure I understand how the mlock-ed memory is used. Are you using a
>> custom malloc, for example with g_mem_set_vtable?
>>
>> Paolo
>
> Hi Paolo:
>
> Thanks for your reply.
> As you know qemu has an option "-mlock", I think it has some problems.
> If we set "-realtime mlock=on", then qemu will mlockall vm's memory, It is a very time consuming action, and it will block the libvirt api until it finished.
> so I think it is better to do 'mlock' asynchronously, the flow chart can be described like below.
Is an asynchronous mlock valid for all workloads? Until the mlock
finishes, there is no guarantee that the guest will have
"real-time--friendly" response to memory allocation.
> Is it ok?
> Flow chart:
> main funciton qmp command "set_ram_minguarantee"
> | |
> | |
> create "mlock" thread change value of lock_ram_size
> | |
> | |
> |------>thread wait<-------------wake up "mlock" thread
> | |
> | |
> | |
> |-------mlock(lock_ram_zie)
Also, I'm not sure what the arguments to mlock are. How do you find the
address range to pass to mlock?
Paolo
prev parent reply other threads:[~2014-03-06 8:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-05 8:01 [Qemu-devel] [RFC] support memory reserved feature and optimize mlock guest memory propose Zhanghailiang
2014-03-05 8:56 ` Paolo Bonzini
2014-03-06 8:06 ` Zhanghailiang
2014-03-06 8:41 ` 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=531834C4.3070609@redhat.com \
--to=pbonzini@redhat.com \
--cc=edgar.iglesias@xilinx.com \
--cc=huangzhichao@huawei.com \
--cc=huazhiqiang@huawei.com \
--cc=kwolf@redhat.com \
--cc=libvir-list@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@gmail.com \
--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).