From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Tan, Jianfeng" Subject: Re: [RFC PATCH 4/5] EAL: Add new EAL "--shm" option. Date: Fri, 22 Jan 2016 10:07:58 +0800 Message-ID: <56A18EFE.5050600@intel.com> References: <1453108389-21006-2-git-send-email-mukawa@igel.co.jp> <1453374478-30996-5-git-send-email-mukawa@igel.co.jp> <56A18958.7070202@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit To: Tetsuya Mukawa , dev@dpdk.org, yuanhan.liu@linux.intel.com Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id CFAE68E81 for ; Fri, 22 Jan 2016 03:08:15 +0100 (CET) In-Reply-To: <56A18958.7070202@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Tetsuya, On 1/22/2016 9:43 AM, Tan, Jianfeng wrote: > Hi Tetsuya, > > On 1/21/2016 7:07 PM, Tetsuya Mukawa wrote: >> This is a temporary patch to get EAL memory under 16T(1 << 44). >> >> The patch adds new EAL "--shm" option. If the option is specified, >> EAL will allocate one file from hugetlbfs. This memory is for sharing >> memory between DPDK applicaiton and QEMU ivhsmem device. >> >> Signed-off-by: Tetsuya Mukawa >> --- >> lib/librte_eal/common/eal_common_options.c | 5 ++ >> lib/librte_eal/common/eal_internal_cfg.h | 1 + >> lib/librte_eal/common/eal_options.h | 2 + >> lib/librte_eal/common/include/rte_memory.h | 5 ++ >> lib/librte_eal/linuxapp/eal/eal_memory.c | 76 >> ++++++++++++++++++++++++++++++ >> 5 files changed, 89 insertions(+) >> > ... >> + vaddr = mmap((void *)(1ULL << 43), size, PROT_READ | PROT_WRITE, >> + MAP_SHARED | MAP_FIXED, fd, 0); >> + if (vaddr != MAP_FAILED) { >> + memset(vaddr, 0, size); >> + *pfd = fd; >> + } > > I'm not sure if hard-coded way is good enough. It's known that kernel > manages VMAs using red-black tree, but I don't know if kernel > allocates VMA from low address to high address (if yes, can we > leverage this feature?). > A little more:it seems that kernel uses arch_get_unmapped_area_topdown() -> unmapped_area_topdown() to do that, which starts at mm->highest_vm_end. If this value bigger than (1ULL << 44)? Thanks, Jianfeng