From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0040.outbound.protection.outlook.com [104.47.2.40]) by dpdk.org (Postfix) with ESMTP id 60BD91CBD2 for ; Thu, 5 Apr 2018 16:08:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=UvtIGLM0tzwIdT3QUw3spocStp7qDfs9vKBRlxOmFW4=; b=pglq5o4myl3qq0GsozkNXzAdHQn8l+hy6jamZnjps2cB+jJ8p+sM6enzfQ6QqzUwzt/8flaAWf7j+QDbLjF1DNbStk16/lwHedPCqpzTACwc1Cj415bWZXNiASz7ANlhlHvH3fJg/yj+fUi3QzD0Qc038BvnpSCVn+3urvv80Go= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; Received: from [10.232.14.39] (14.142.187.166) by DB6PR0402MB2776.eurprd04.prod.outlook.com (2603:10a6:4:96::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.631.10; Thu, 5 Apr 2018 14:07:55 +0000 To: Anatoly Burakov , dev@dpdk.org Cc: Marcin Wojtas , Michal Krawczyk , Guy Tzalik , Evgeny Schemeilin , Bruce Richardson , keith.wiles@intel.com, jianfeng.tan@intel.com, andras.kovacs@ericsson.com, laszlo.vadkeri@ericsson.com, benjamin.walker@intel.com, thomas@monjalon.net, konstantin.ananyev@intel.com, kuralamudhan.ramakrishnan@intel.com, louise.m.daly@intel.com, nelio.laranjeiro@6wind.com, yskoh@mellanox.com, pepperjo@japf.ch, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, olivier.matz@6wind.com, shreyansh.jain@nxp.com, gowrishankar.m@linux.vnet.ibm.com References: <8a674bd144b81203642082e8fc79446a9ddb552e.1522797505.git.anatoly.burakov@intel.com> From: Shreyansh Jain Message-ID: <2a275e55-6e18-1e8c-4d05-351c805d5b3f@nxp.com> Date: Thu, 5 Apr 2018 19:53:08 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <8a674bd144b81203642082e8fc79446a9ddb552e.1522797505.git.anatoly.burakov@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BM1PR01CA0100.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::16) To DB6PR0402MB2776.eurprd04.prod.outlook.com (2603:10a6:4:96::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 04d1f6d6-7718-4e7c-64bc-08d59afea356 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0402MB2776; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0402MB2776; 3:sTSYEjSQ+pYuu0S3scOG1OpWI8YjDk9iRF/D9wL4bnoR5DfF7wnVGMM4M6tnyT2Y3/lZ0RapTBiJOnTpu5sEmRLR9TKB5yBO/qaoSomn2ocJOwr9GirrLEhWCB3VCidz0d3A6nJhZe3JmzrNn/zTSuhQnBEj4ucuZlvEOQHxP4WxKFaSqzs4heGms9G3dx6LEgBaj4ZJrGM0PArVVJu0EDVHf/fJYpH99JFfWoSf8occ5MAsG1mIvsUw/2lQfIeF; 25:ow233chfCTSx2DZCQzmux61tok4Mk8gXyRyPXGEj1J+Gnck/ehlEDbCebQ8vpvskVliqxl0ud/+cVK04ggaWlgIhLet2+3hvMeHIGnuKmaxGLs9KQg85cEm2pAMXD2H0jNN14xxQ9JadoFU9AzkcK7gYkRhlbCbPOKjL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HRhpKtUvO9+s9XE/4qQm2UvSAJLsT908t8Zvzmk5eRHr1zf515GF2MpQ2m0Mzcix+CZmCEoPpI/qJcNPTgn/dJFvolPiEn1JsGllwUfgWRmiRR97IcL+HVXmK19KLRMowRPVNjJpVKf/krR1quQls5ys+KxsLDsUBBq2nVp8CWSp241U/XIEzUY0kAenTvAis2TvqeqBEz5D4mS+7EUXsQqWZBtkCgsmI5zuYLg/VzjSnSQZpZ4QnjoUOlh5E0ONKOcUvvyKw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231221)(944501327)(52105095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:DB6PR0402MB2776; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0402MB2776; X-Forefront-PRVS: 06339BAE63 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(39380400002)(396003)(376002)(39860400002)(346002)(366004)(199004)(189003)(54906003)(186003)(26005)(5660300001)(230700001)(55236004)(8676002)(6116002)(229853002)(3846002)(64126003)(36756003)(81166006)(50466002)(81156014)(65826007)(77096007)(5890100001)(31696002)(386003)(486006)(6666003)(11346002)(31686004)(7416002)(58126008)(316002)(76176011)(52116002)(106356001)(16576012)(8936002)(16526019)(105586002)(97736004)(2616005)(305945005)(65956001)(53936002)(446003)(7736002)(476003)(5009440100003)(6486002)(68736007)(6246003)(956004)(66066001)(4326008)(86362001)(478600001)(47776003)(23676004)(25786009)(2906002)(52146003)(67846002)(2486003)(65806001)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0402MB2776; H:[10.232.14.39]; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtEQjZQUjA0MDJNQjI3NzY7MjM6cUVuYzUrOG5qazdrWGxDKy9ncVI2ayt0?= =?utf-8?B?a3RnOVNKUGgveU5EMkpqc1JmbjRsZ1RoYXVzaS90YzZCVzMrdW5ESFY1S3J1?= =?utf-8?B?bjJOelV4S1hHWS85aUtGR3FhVkthK1AwS3RmRzJBRTNPektvQ1lNMUpSaDdp?= =?utf-8?B?WHZZOE0zY0pHVGx0YVFQZG5NS1J2YTN0aE5POXVVck14dExrQTdCS2tuaEs5?= =?utf-8?B?UkpIdzNqS3UvVFhmUFN6ZmloZmJqT1R2cEZlTDZMUEVNZml0V2V4Y2I5Z3NZ?= =?utf-8?B?eE4rTGo2VU5Ddk1TTThleEdlUTJrVDJmbHYweE5XeThmQ2lkemo3WHEvMklr?= =?utf-8?B?YWRTWWJDa3NQam5pRVZ4MTE2UFJ6NmhHb0dIQkNpYnV3NXNPRnExbnBrd3dC?= =?utf-8?B?ZmwzZXFDWUtkcXZPWTkvRjVjWWFBOHJVamIxOGppQjF6WDZhdnhXb1MzKzJX?= =?utf-8?B?WjJwempHQ3lWZmMzOVo1WitvMTd3WHFBdjJYZmdBcyt2YytTMEF2OHZOZ1hh?= =?utf-8?B?NFRHNWZhWlZlMHl0L01CWHNVLzQzdDZxOWptRCtINTNHOW9ORHVSUUdKYUZL?= =?utf-8?B?QlNZemU3aTVsSTVLaGlyU0QwZjUrQkYvZWU0a0J1M0JMcjZPdWZ2anNLVTRn?= =?utf-8?B?M1A2QlVlTENLUWt5WVlWV0JwSWJKWGJCV2FqYTE2d3N0SjE0NDJxZEJPcklH?= =?utf-8?B?bmtWTEdPUSt3cTVwOTZGVWJ6RHhoZldtNk8yY1dyN2ZtSVVyeGY0SXpGYk1q?= =?utf-8?B?bjZSYmd4anVtWWlTNStoSE5OaFB4YWJpWG1BS3BRclJZU3J5aS9vTXR5U0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FLjsbOVFfOG9mI7WJVzUnD0jez3NYnRQBd6ucFY/JEV2Fv+2hwaBiwTIs4akDwQ==; 5:neX1pqhC/Ra3KSfXQ9hSFBysqjG9gAlI59nBHx9on6gQQuxNvMg3fiqNk25R0W3GRxM+WoHS/ZRLqYZC61hDpNxyflYE7Yc5F1efKNVSYFTg8oSU7JX6wyWmj18Ba09Oq0tMGb5bhBhQ08csfUH8YF1Zoon7xP+5aGuPE2VytsM=; 24:M4dFmr1b6bNcgjviYaA1HRc8O3S3R/JjnlKX1YD+ds5VcxzuWH8Lr+0wZVjABFsODdr76dBfGV2u5H5YRMqTHKn5Ai3t47awDtJ7cw7iUhg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0402MB2776; 7:QI2KFbw7wzVVJrttrd7B5jteOIY0MP3xtSFDcx8v9WOY77UiMEXV9eDHVmcwpWjBgFdu93zTbQaB9YhnYUb2ZQoifCqwEQHskaUbHcgBZQ7SjkQ6zKVyx8U6FbSc6X1JIZb2gvHVhfHgmB0hY1/K6Uq6Q3AXRqdxzjm1tp8PMawPpJdMy8ygRbPC+Qkw5fMeG1vjGmK4niu+hWeKExjwK7JddoRNbwnH02UuArhgdNcEE/kRCTTVk/IQaFudohGe X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2018 14:07:55.5355 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 04d1f6d6-7718-4e7c-64bc-08d59afea356 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0402MB2776 Subject: Re: [dpdk-dev] [PATCH v3 50/68] eal: replace memzone array with fbarray 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: Thu, 05 Apr 2018 14:08:01 -0000 On Wednesday 04 April 2018 04:52 AM, Anatoly Burakov wrote: > It's there, so we might as well use it. Some operations will be > sped up by that. > > Since we have to allocate an fbarray for memzones, we have to do > it before we initialize memory subsystem, because that, in > secondary processes, will (later) allocate more fbarrays than the > primary process, which will result in inability to attach to > memzone fbarray if we do it after the fact. > > Signed-off-by: Anatoly Burakov > --- > > Notes: > v3: > - Moved earlier in patchset > - Fixed compiled issues > - Removed rte_panic() calls > [...] > diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c > index 529b36f..aed9331 100644 > --- a/lib/librte_eal/common/eal_common_memzone.c > +++ b/lib/librte_eal/common/eal_common_memzone.c > @@ -28,42 +28,31 @@ > static inline const struct rte_memzone * > memzone_lookup_thread_unsafe(const char *name) > { > - const struct rte_mem_config *mcfg; > + struct rte_mem_config *mcfg; > + struct rte_fbarray *arr; > const struct rte_memzone *mz; > - unsigned i = 0; > + int i = 0; > > /* get pointer to global configuration */ > mcfg = rte_eal_get_configuration()->mem_config; > + arr = &mcfg->memzones; > > /* > * the algorithm is not optimal (linear), but there are few > * zones and this function should be called at init only > */ > - for (i = 0; i < RTE_MAX_MEMZONE; i++) { > - mz = &mcfg->memzone[i]; > - if (mz->addr != NULL && !strncmp(name, mz->name, RTE_MEMZONE_NAMESIZE)) > - return &mcfg->memzone[i]; > + i = rte_fbarray_find_next_used(arr, 0); > + while (i >= 0) { > + mz = rte_fbarray_get(arr, i++); ^^^^^^^^ As discussed offline, this needs to be changed. Double increment of 'i' leading to skips over lookup. > + if (mz->addr != NULL && > + !strncmp(name, mz->name, RTE_MEMZONE_NAMESIZE)) > + return mz; > + i = rte_fbarray_find_next_used(arr, i + 1); > } > > return NULL; > } > [..] - Shreyansh