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 08F433794 for ; Wed, 8 Jun 2016 13:27:37 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 08 Jun 2016 04:27:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,438,1459839600"; d="scan'208";a="715819144" Received: from smonroyx-mobl.ger.corp.intel.com (HELO [10.237.220.56]) ([10.237.220.56]) by FMSMGA003.fm.intel.com with ESMTP; 08 Jun 2016 04:27:35 -0700 From: Sergio Gonzalez Monroy To: Jianfeng Tan , dev@dpdk.org References: <1453661393-85704-1-git-send-email-jianfeng.tan@intel.com> <1464665827-24965-1-git-send-email-jianfeng.tan@intel.com> Cc: nhorman@tuxdriver.com, david.marchand@6wind.com, thomas.monjalon@6wind.com Message-ID: <5e903b16-453e-100f-fea4-75229e33344f@intel.com> Date: Wed, 8 Jun 2016 12:27:35 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <1464665827-24965-1-git-send-email-jianfeng.tan@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v5] eal: fix allocating all free hugepages 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: Wed, 08 Jun 2016 11:27:38 -0000 On 31/05/2016 04:37, Jianfeng Tan wrote: > EAL memory init allocates all free hugepages of the whole system, > which seen from sysfs, even when applications do not ask so many. > When there is a limitation on how many hugepages an application can > use (such as cgroup.hugetlb), or hugetlbfs is specified with an > option of size (exceeding the quota of the fs), it just fails to > start even there are enough hugepages allocated. > > To fix above issue, this patch: > - Changes the logic to continue memory init to see if hugetlb > requirement of application can be addressed by already allocated > hugepages. > - To make sure each hugepage is allocated successfully, we add a > recover mechanism, which relies on a mem access to fault-in > hugepages, and if it fails with SIGBUS, recover to previously > saved stack environment with siglongjmp(). > > For the case of CONFIG_RTE_EAL_SINGLE_FILE_SEGMENTS (enabled by > default when compiling IVSHMEM target), it's indispensable to > mapp all free hugepages in the system. Under this case, it fails > to start when allocating fails. > > Test example: > a. cgcreate -g hugetlb:/test-subgroup > b. cgset -r hugetlb.1GB.limit_in_bytes=2147483648 test-subgroup > c. cgexec -g hugetlb:test-subgroup \ > ./examples/helloworld/build/helloworld -c 0x2 -n 4 > > > Fixes: af75078fece ("first public release") > > Signed-off-by: Jianfeng Tan > Acked-by: Neil Horman > --- > v5: > - Make this method as default instead of using an option. > - When SIGBUS is triggered in the case of RTE_EAL_SINGLE_FILE_SEGMENTS, > just return error. > - Add prefix "huge_" to newly added function and static variables. > - Move the internal_config.memory assignment after the page allocations. > v4: > - Change map_all_hugepages to return unsigned instead of int. > v3: > - Reword commit message to include it fixes the hugetlbfs quota issue. > - setjmp -> sigsetjmp. > - Fix RTE_LOG complaint from ERR to DEBUG as it does not mean init error > so far. > - Fix the second map_all_hugepages's return value check. > v2: > - Address the compiling error by move setjmp into a wrap method. > > lib/librte_eal/linuxapp/eal/eal.c | 20 ----- > lib/librte_eal/linuxapp/eal/eal_memory.c | 138 ++++++++++++++++++++++++++++--- > 2 files changed, 125 insertions(+), 33 deletions(-) > Acked-by: Sergio Gonzalez Monroy