From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 3F806AFD9 for ; Tue, 27 May 2014 05:27:54 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 26 May 2014 20:22:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,916,1392192000"; d="scan'208,217";a="546898612" Received: from fmsmsx104.amr.corp.intel.com ([10.19.9.35]) by orsmga002.jf.intel.com with ESMTP; 26 May 2014 20:28:04 -0700 Received: from fmsmsx102.amr.corp.intel.com (10.19.9.53) by FMSMSX104.amr.corp.intel.com (10.19.9.35) with Microsoft SMTP Server (TLS) id 14.3.123.3; Mon, 26 May 2014 20:28:03 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX102.amr.corp.intel.com (10.19.9.53) with Microsoft SMTP Server (TLS) id 14.3.123.3; Mon, 26 May 2014 20:28:03 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.7]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.34]) with mapi id 14.03.0123.003; Tue, 27 May 2014 11:28:02 +0800 From: "Xu, HuilongX" To: "dev@dpdk.org" , "Burakov, Anatoly" Thread-Topic: RE: [dpdk-dev] [PATCH v2 11/16] Make --no-huge use mmap instead of malloc Thread-Index: Ac95W6j4vyd2dV2YSx6G26NX2LQIZg== Date: Tue, 27 May 2014 03:28:01 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-cr-hashedpuzzle: AJGi AZRw Bn+t DPpG DdZH DnJQ Figq GAGO GIsD GfxU HYZA H5Ok JDwW JS/I Ja2w K1Zg; 1; ZABlAHYAQABkAHAAZABrAC4AbwByAGcA; Sosha1_v1; 7; {4E90B3F3-5F22-4677-8DF4-A8213F0BE2C6}; aAB1AGkAbABvAG4AZwB4AC4AeAB1AEAAaQBuAHQAZQBsAC4AYwBvAG0A; Tue, 27 May 2014 03:28:00 GMT; UgBFADoAIABbAGQAcABkAGsALQBkAGUAdgBdACAAWwBQAEEAVABDAEgAIAB2ADIAIAAxADEALwAxADYAXQAgAE0AYQBrAGUAIAAtAC0AbgBvAC0AaAB1AGcAZQAgAHUAcwBlACAAbQBtAGEAcAAgAGkAbgBzAHQAZQBhAGQAIABvAGYACQBtAGEAbABsAG8AYwA= x-cr-puzzleid: {4E90B3F3-5F22-4677-8DF4-A8213F0BE2C6} x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v2 11/16] Make --no-huge use mmap instead of malloc 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: Tue, 27 May 2014 03:27:55 -0000 This makes it possible to run DPDK without hugepage memory when VFIO is used, as VFIO uses virtual addresses to set up DMA mappings. Signed-off-by: Anatoly Burakov > Test-by: HuilongX Xu huilongx.xu@intel.com Compile pass >>Compile OS: FC20 x86_64 >>Kernel version: 3.13.6-200 >>GCC version: 4.8.2 >>Server: Crownpass --- lib/librte_eal/linuxapp/eal/eal_memory.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linu= xapp/eal/eal_memory.c index 5a10a80..3fc0d28 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -1031,7 +1031,13 @@ rte_eal_hugepage_init(void) /* hugetlbfs can be disabled */ if (internal_config.no_hugetlbfs) { - addr =3D malloc(internal_config.memory); + addr =3D mmap(NULL, internal_config.memory, PROT_READ | PROT= _WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); + if (addr =3D=3D MAP_FAILED) { + RTE_LOG(ERR, EAL, "%s: mmap() failed: %s\n", __func_= _, + strerror(errno)); + return -1; + } mcfg->memseg[0].phys_addr =3D (phys_addr_t)(uintptr_t)addr; mcfg->memseg[0].addr =3D addr; mcfg->memseg[0].len =3D internal_config.memory; -- 1.7.0.7