From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: "Tan, Jianfeng" <jianfeng.tan@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "yliu@fridaylinux.org" <yliu@fridaylinux.org>
Subject: Re: [PATCH 4/4] vhost: avoid populate guest memory
Date: Thu, 22 Feb 2018 09:25:37 +0100 [thread overview]
Message-ID: <87337fa8-66fb-f9ec-45c2-78042bb47759@redhat.com> (raw)
In-Reply-To: <ED26CBA2FAD1BF48A8719AEF02201E365144A6EB@SHSMSX103.ccr.corp.intel.com>
On 02/22/2018 03:42 AM, Tan, Jianfeng wrote:
> Hi Maxime,
>
>> -----Original Message-----
>> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
>> Sent: Tuesday, February 20, 2018 4:45 AM
>> To: Tan, Jianfeng; dev@dpdk.org
>> Cc: yliu@fridaylinux.org
>> Subject: Re: [PATCH 4/4] vhost: avoid populate guest memory
>>
>> Hi Jianfeng,
>>
>> On 02/14/2018 05:01 AM, Jianfeng Tan wrote:
>>> It's not necessary to polulate guest memory from vhost side.
>>>
>>> Cc: maxime.coquelin@redhat.com
>>> Cc: yliu@fridaylinux.org
>>>
>>> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
>>> ---
>>> lib/librte_vhost/vhost_user.c | 4 +++-
>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
>>> index 90ed211..9bd0391 100644
>>> --- a/lib/librte_vhost/vhost_user.c
>>> +++ b/lib/librte_vhost/vhost_user.c
>>> @@ -644,6 +644,7 @@ vhost_user_set_mem_table(struct virtio_net *dev,
>> struct VhostUserMsg *pmsg)
>>> uint64_t mmap_offset;
>>> uint64_t alignment;
>>> uint32_t i;
>>> + int populate;
>>> int fd;
>>>
>>> if (dev->mem && !vhost_memory_changed(&memory, dev->mem))
>> {
>>> @@ -714,8 +715,9 @@ vhost_user_set_mem_table(struct virtio_net *dev,
>> struct VhostUserMsg *pmsg)
>>> }
>>> mmap_size = RTE_ALIGN_CEIL(mmap_size, alignment);
>>>
>>> + populate = (dev->dequeue_zero_copy) ? MAP_POPULATE :
>> 0;
>>> mmap_addr = mmap(NULL, mmap_size, PROT_READ |
>> PROT_WRITE,
>>> - MAP_SHARED | MAP_POPULATE, fd, 0);
>>> + MAP_SHARED | populate, fd, 0);
>>>
>>> if (mmap_addr == MAP_FAILED) {
>>> RTE_LOG(ERR, VHOST_CONFIG,
>>>
>>
>> Wouldn't not populating all the guest memory have a bad impact on 0%
>> acceptable loss use-cases?
>
> Yes, it could affect such use case; but we can address that by warming up the system a little bit, can't we?
I'm not sure this is a good idea to ask the real user to warm-up the
system.
Also, even with benchmarking, the loss happens when the queues are full,
so it is likely that it happens with buffers not used before, even if
system has been warmed-up.
> From a good point of view, it could save the memory for VMs without pre-allocating.
What could be done is maybe to have an EAL API for mmaping, with an
associated EAL parameter to state whether it want populating or not.
This option would be disabled by default.
Does that sounds reasonable?
Cheers,
Maxime
> Thanks,
> Jianfeng
>
next prev parent reply other threads:[~2018-02-22 8:25 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-14 4:01 [PATCH 0/4] some fixes target for 18.05 Jianfeng Tan
2018-02-14 4:01 ` [PATCH 1/4] vhost: remove unused macro Jianfeng Tan
2018-02-19 20:49 ` Maxime Coquelin
2018-02-21 7:32 ` Maxime Coquelin
2018-02-14 4:01 ` [PATCH 2/4] vhost: avoid function call in data path Jianfeng Tan
2018-02-19 20:48 ` Maxime Coquelin
2018-02-21 7:32 ` Maxime Coquelin
2018-02-14 4:01 ` [PATCH 3/4] app/testpmd: add option to avoid lock all memory Jianfeng Tan
2018-02-14 6:40 ` Wu, Jingjing
2018-02-24 3:26 ` [PATCH v2] " Jianfeng Tan
2018-04-22 23:05 ` Thomas Monjalon
2018-05-03 11:32 ` Burakov, Anatoly
2018-02-14 4:01 ` [PATCH 4/4] vhost: avoid populate guest memory Jianfeng Tan
2018-02-19 20:44 ` Maxime Coquelin
2018-02-22 2:42 ` Tan, Jianfeng
2018-02-22 8:25 ` Maxime Coquelin [this message]
2018-02-22 8:40 ` Tan, Jianfeng
2018-02-22 12:32 ` Maxime Coquelin
2018-02-23 3:17 ` Tan, Jianfeng
2018-03-28 6:56 ` [PATCH v2] " Jianfeng Tan
2018-03-30 8:21 ` Maxime Coquelin
2018-03-30 8:34 ` Maxime Coquelin
2018-02-21 7:35 ` [PATCH 0/4] some fixes target for 18.05 Maxime Coquelin
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=87337fa8-66fb-f9ec-45c2-78042bb47759@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=dev@dpdk.org \
--cc=jianfeng.tan@intel.com \
--cc=yliu@fridaylinux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.