From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 1F9DA5951 for ; Thu, 1 May 2014 13:06:36 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 01 May 2014 04:06:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,964,1389772800"; d="scan'208";a="504218287" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by orsmga001.jf.intel.com with ESMTP; 01 May 2014 04:06:10 -0700 Received: from irsmsx108.ger.corp.intel.com (163.33.3.3) by IRSMSX104.ger.corp.intel.com (163.33.3.159) with Microsoft SMTP Server (TLS) id 14.3.123.3; Thu, 1 May 2014 12:06:09 +0100 Received: from irsmsx101.ger.corp.intel.com ([169.254.1.249]) by IRSMSX108.ger.corp.intel.com ([169.254.11.221]) with mapi id 14.03.0123.003; Thu, 1 May 2014 12:06:08 +0100 From: "Burakov, Anatoly" To: "dev@dpdk.org" Thread-Topic: [PATCH 11/16] [RFC] [VFIO] Make --no-huge use mmap instead of malloc Thread-Index: Ac9lLMUrhMFhvGqgTj61VUWCcK/yDQ== Date: Thu, 1 May 2014 11:06:08 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 11/16] [RFC] [VFIO] 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: Thu, 01 May 2014 11:06:37 -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 diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linu= xapp/eal/eal_memory.c index 73a6394..b075145 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -991,7 +991,13 @@ rte_eal_hugepage_init(void) =20 /* 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; --=20 1.8.1.4