From patchwork Thu Aug 17 04:28:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 130452 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 201BF4308A; Thu, 17 Aug 2023 06:28:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9B4C043260; Thu, 17 Aug 2023 06:28:30 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mails.dpdk.org (Postfix) with ESMTP id 37167410D0 for ; Thu, 17 Aug 2023 06:28:27 +0200 (CEST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A4E086359E; Thu, 17 Aug 2023 04:28:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B57B3C433C7; Thu, 17 Aug 2023 04:28:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692246506; bh=kQPdVXV3lWVo3QccrFQe9GkdRIaGrSM4PE0efcAjE70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l6LOwSo9mB67/HqCXwQEvVUC9dF6mSe9w4d8nU7OGMItPqYP8H66tUoPB1DeZ8dOO O22qZhms1J43F9LlZyqXlPN5YBO79XN9x7Cg+dUaugOTXddgxAqK7hQTsyMv3eH9zO 8IakjehDyo3rL0KBN9tuhEhnx7GabG3uCZ0Owbg+LeGbYqDPj+2htenf5agkWrjlq9 rNcBdjTxac9//4ug+v50I5DQ5imRFq64kaabsguEOakCAIfoGVjTD1GQ1feggruIJj d/ysYwVknK2MQ7k7sakzIYtbIzHSFZ+ZleWUDCRqCLoYwQ1JOtvi2EBDdLvRZJ/rr2 Hu44kpFVee8bg== From: okaya@kernel.org To: Anatoly Burakov Cc: dev@dpdk.org, Sinan Kaya Subject: [PATCH v5 04/10] eal_memzone: bail out on initialized Date: Thu, 17 Aug 2023 00:28:15 -0400 Message-Id: <20230817042820.137957-5-okaya@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230817042820.137957-1-okaya@kernel.org> References: <20230817042820.137957-1-okaya@kernel.org> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Sinan Kaya Initialize memzone once and bail out if someone calls init multiple times. Signed-off-by: Sinan Kaya --- lib/eal/common/eal_common_memzone.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/eal/common/eal_common_memzone.c b/lib/eal/common/eal_common_memzone.c index 1f3e701499..d2fac4be01 100644 --- a/lib/eal/common/eal_common_memzone.c +++ b/lib/eal/common/eal_common_memzone.c @@ -425,6 +425,10 @@ rte_eal_memzone_init(void) { struct rte_mem_config *mcfg; int ret = 0; + static bool run_once; + + if (run_once) + return 0; /* get pointer to global configuration */ mcfg = rte_eal_get_configuration()->mem_config; @@ -444,6 +448,8 @@ rte_eal_memzone_init(void) rte_rwlock_write_unlock(&mcfg->mlock); + run_once = true; + return ret; }