From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [119.145.14.65]) by dpdk.org (Postfix) with ESMTP id 432A75A9A for ; Thu, 12 Feb 2015 09:26:34 +0100 (CET) Received: from 172.24.2.119 (EHLO szxeml426-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CHE96440; Thu, 12 Feb 2015 16:26:27 +0800 (CST) Received: from [127.0.0.1] (10.177.19.115) by szxeml426-hub.china.huawei.com (10.82.67.181) with Microsoft SMTP Server id 14.3.158.1; Thu, 12 Feb 2015 16:26:23 +0800 Message-ID: <54DC63AD.7020007@huawei.com> Date: Thu, 12 Feb 2015 16:26:22 +0800 From: Linhaifeng User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: Huawei Xie , References: <1423717649-11818-1-git-send-email-huawei.xie@intel.com> <1423717649-11818-10-git-send-email-huawei.xie@intel.com> In-Reply-To: <1423717649-11818-10-git-send-email-huawei.xie@intel.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.19.115] X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH v2 09/11] lib/librte_vhost: vhost user support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Feb 2015 08:26:36 -0000 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