From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 69EBAA00C5; Thu, 30 Apr 2020 15:59:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 01F5C1DBEE; Thu, 30 Apr 2020 15:59:21 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id E207E1DBE8 for ; Thu, 30 Apr 2020 15:59:18 +0200 (CEST) IronPort-SDR: bgP1wYZs1w2DKMx7sSU7NzF04ht9eR5eF/2V4BOYw1MrV3eVcrfnKtTPdSHMrsuVL2Ub7CNNL2 TswbMU0bqBoQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Apr 2020 06:59:17 -0700 IronPort-SDR: PM0pABfS2Qt1meU3wJgqh7P73+FHpFHC31fhO+0RDk1kRkHvgyww677aG2gnC+OnEuaLf8y6Sf 28eHvG+cvruA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,336,1583222400"; d="scan'208";a="337305993" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.249.32.101]) ([10.249.32.101]) by orsmga001.jf.intel.com with ESMTP; 30 Apr 2020 06:59:15 -0700 From: "Burakov, Anatoly" To: Dmitry Kozlyuk , dev@dpdk.org Cc: "Dmitry Malloy (MESHCHANINOV)" , Narcisa Ana Maria Vasile , Fady Bader , Tal Shnaiderman , Bruce Richardson References: <20200410164342.1194634-1-dmitry.kozliuk@gmail.com> <20200428235015.2820677-1-dmitry.kozliuk@gmail.com> <20200428235015.2820677-4-dmitry.kozliuk@gmail.com> <87a53d30-0cf4-2e0d-1336-3420f0e0b6d3@intel.com> Message-ID: <678dc8ac-4e32-5a5f-bf27-4ac3d7150172@intel.com> Date: Thu, 30 Apr 2020 14:59:14 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <87a53d30-0cf4-2e0d-1336-3420f0e0b6d3@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v4 3/8] eal: introduce memory management wrappers 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 29-Apr-20 6:13 PM, Burakov, Anatoly wrote: >> @@ -547,10 +531,10 @@ rte_eal_memdevice_init(void) >>   int >>   rte_mem_lock_page(const void *virt) >>   { >> -    unsigned long virtual = (unsigned long)virt; >> -    int page_size = getpagesize(); >> -    unsigned long aligned = (virtual & ~(page_size - 1)); >> -    return mlock((void *)aligned, page_size); >> +    uintptr_t virtual = (uintptr_t)virt; >> +    int page_size = rte_get_page_size(); >> +    uintptr_t aligned = (virtual & ~(page_size - 1)); > > Might as well fix to use macros? e.g. > > size_t pagesz = rte_get_page_size(); > return rte_mem_lock(RTE_PTR_ALIGN(virt, pagesz), pagesz); > > (also, note that rte_get_page_size() returns size_t, not int) Apologies, this should've been RTE_PTR_ALIGN_FLOOR(virt, pagesz) -- Thanks, Anatoly