From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linhaifeng Subject: Re: [PATCH v2 09/11] lib/librte_vhost: vhost user support Date: Thu, 12 Feb 2015 16:26:22 +0800 Message-ID: <54DC63AD.7020007@huawei.com> References: <1423717649-11818-1-git-send-email-huawei.xie@intel.com> <1423717649-11818-10-git-send-email-huawei.xie@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit To: Huawei Xie , Return-path: In-Reply-To: <1423717649-11818-10-git-send-email-huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> 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 2015/2/12 13:07, Huawei Xie wrote: > + > + /* This is ugly */ > + mapped_size = memory.regions[idx].memory_size + > + memory.regions[idx].mmap_offset; > + mapped_address = (uint64_t)(uintptr_t)mmap(NULL, > + mapped_size, > + PROT_READ | PROT_WRITE, MAP_SHARED, > + pmsg->fds[idx], > + 0); Just another ugly way: We can use the size of file to mmap then unmmap is not need align to the size of page. -- Regards, Haifeng