From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6A63E43067; Tue, 15 Aug 2023 03:38:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 267A143261; Tue, 15 Aug 2023 03:38:42 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mails.dpdk.org (Postfix) with ESMTP id 39D71427E9 for ; Tue, 15 Aug 2023 03:38:37 +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 AC8816133D; Tue, 15 Aug 2023 01:38:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D7C4C433CA; Tue, 15 Aug 2023 01:38:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692063516; bh=1PXlkXCH2bZmihyGtBH6XHPcsIBcFOinXg+ist8AKj4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fFNu7Vd5ix/3cp4OujJi770Q22OuZnyE7VXshXCuJmUTHr4kstvvG9Gb063BLY99g R64SSGZu5OJa0UMm35mSq+HvLkIH7m0psF18dOR9m3xuPvEnpWhNheV2u1mOG9t7qh BpTlcTm89KQSs4zgaeQQm35Ma40/utNxPCe7fEheOWjFYir2RBxmiGOL3SfN2M/nV9 wIAs16HZbB6VtNMoITj1LmJIXtQIWM32Z1e/QxZNMidIQsJ/mJ7iYc5mMc+RrmbC4l AMRDTUkjpbtN7V9syMRm5jhKUNFfIt/QkR2DcIabanKTugfLeddVJfl8NQabd4TLEX xFtKzjtnVsnRQ== From: okaya@kernel.org To: Anatoly Burakov Cc: dev@dpdk.org, Sinan Kaya Subject: [PATCH v1 3/7] eal_memzone: bail out on initialized Date: Mon, 14 Aug 2023 21:38:22 -0400 Message-Id: <20230815013826.1288972-4-okaya@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230815013826.1288972-1-okaya@kernel.org> References: <20230815013826.1288972-1-okaya@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 930fee5fdc..c76f298267 100644 --- a/lib/eal/common/eal_common_memzone.c +++ b/lib/eal/common/eal_common_memzone.c @@ -395,8 +395,12 @@ int rte_eal_memzone_init(void) { struct rte_mem_config *mcfg; + static int initialized = 0; int ret = 0; + if (initialized) + return 0; + /* get pointer to global configuration */ mcfg = rte_eal_get_configuration()->mem_config; @@ -415,6 +419,8 @@ rte_eal_memzone_init(void) rte_rwlock_write_unlock(&mcfg->mlock); + initialized = 1; + return ret; } -- 2.25.1