From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Xie, Huawei" Subject: Re: [PATCH v2 09/11] lib/librte_vhost: vhost user support Date: Thu, 12 Feb 2015 09:28:09 +0000 Message-ID: References: <1423717649-11818-1-git-send-email-huawei.xie@intel.com> <1423717649-11818-10-git-send-email-huawei.xie@intel.com> <54DC63AD.7020007@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable To: Linhaifeng , "dev-VfR2kkLFssw@public.gmane.org" Return-path: Content-Language: en-US List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" On 2/12/2015 4:28 PM, Linhaifeng wrote:=0A= >=0A= > On 2015/2/12 13:07, Huawei Xie wrote:=0A= >> +=0A= >> + /* This is ugly */=0A= >> + mapped_size =3D memory.regions[idx].memory_size +=0A= >> + memory.regions[idx].mmap_offset;=0A= >> + mapped_address =3D (uint64_t)(uintptr_t)mmap(NULL,=0A= >> + mapped_size,=0A= >> + PROT_READ | PROT_WRITE, MAP_SHARED,=0A= >> + pmsg->fds[idx],=0A= >> + 0);=0A= > Just another ugly way:=0A= > We can use the size of file to mmap then unmmap is not need align to the = size of page.=0A= >=0A= Yes, this is like how cuses handle mmap.=0A= We will add this into the to-do list, combine all the regions the first,=0A= check if they belong to the same file, and then map each file once.=0A= Seems there is no elegant way.=0A= =0A= There is another to do for mmap. If there are multiple virtio devices,=0A= the memory are mapped for each virtio device. Actually we only need once.= =0A= =0A= =0A=