From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 68EE71B120; Wed, 3 Oct 2018 14:50:30 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Oct 2018 05:50:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,336,1534834800"; d="scan'208";a="97057130" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.113]) ([10.237.220.113]) by orsmga002.jf.intel.com with ESMTP; 03 Oct 2018 05:50:06 -0700 To: Alejandro Lucero , dev@dpdk.org Cc: stable@dpdk.org References: <1535719857-19092-1-git-send-email-alejandro.lucero@netronome.com> <1535719857-19092-3-git-send-email-alejandro.lucero@netronome.com> From: "Burakov, Anatoly" Message-ID: <6bddf8bd-ecc0-5170-7265-e49488909f4e@intel.com> Date: Wed, 3 Oct 2018 13:50:05 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1535719857-19092-3-git-send-email-alejandro.lucero@netronome.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 2/5] mem: use address hint for mapping hugepages X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Oct 2018 12:50:31 -0000 On 31-Aug-18 1:50 PM, Alejandro Lucero wrote: > Linux kernel uses a really high address as starting address for > serving mmaps calls. If there exist addressing limitations and > IOVA mode is VA, this starting address is likely too high for > those devices. However, it is possible to use a lower address in > the process virtual address space as with 64 bits there is a lot > of available space. > > This patch adds an address hint as starting address for 64 bits > systems. > > Signed-off-by: Alejandro Lucero > --- > > mapped_addr = mmap(requested_addr, (size_t)map_sz, PROT_READ, > mmap_flags, -1, 0); > + > if (mapped_addr == MAP_FAILED && allow_shrink) Unintended whitespace change? > *size -= page_sz; > - } while (allow_shrink && mapped_addr == MAP_FAILED && *size > 0); > + > + if (mapped_addr != MAP_FAILED && addr_is_hint && > + mapped_addr != requested_addr) { > + /* hint was not used. Try with another offset */ > + munmap(mapped_addr, map_sz); > + mapped_addr = MAP_FAILED; > + next_baseaddr = RTE_PTR_ADD(next_baseaddr, 0x100000000); Why not increment by page size? Sure, it could take some more time to allocate, but will result in less wasted memory. -- Thanks, Anatoly