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 E896443073; Tue, 15 Aug 2023 16:50:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0CC1343268; Tue, 15 Aug 2023 16:50:38 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mails.dpdk.org (Postfix) with ESMTP id 6F4ED4325B for ; Tue, 15 Aug 2023 16:50:35 +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 001AD61CC0; Tue, 15 Aug 2023 14:50:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0454C433CA; Tue, 15 Aug 2023 14:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692111034; bh=joa54IhMnxETGrrAfoMJz218LI2OKvqtobhOYXCZW5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nA5VOWudCihAeirtZ5VIfkWfY2HZUApIJzVmJAl8nY2JFHZDSzflvi6as3h5QI7Ah As11gUo268j01y12vPp/e8sCbgdJ1zrQtYYarV7WvQZ9CneftcP3JyN4uSVsHDUhb4 /2tRZZb5odyhWv+tFlt4+o6xeZ4iqyPDLoEjozbvjfV2sQ2Zcyq4Ck96K681ypaYo+ zqP16qrFPsrqCwHanVbOgxLUhQ8jsEQY9YViry9u7sJEyEyYooMPVx5IEgL2UrlzUI 8LyM4t5GtKVZ7B/DMRmd48F98zZgCpXQoEIfqs7qVyM79z4dCgTv6vOFkCKVi6IEN2 0xT22KJeMsYzQ== From: okaya@kernel.org To: Anatoly Burakov Cc: dev@dpdk.org, Sinan Kaya Subject: [PATCH v4 4/8] eal_memzone: bail out on initialized Date: Tue, 15 Aug 2023 10:50:19 -0400 Message-Id: <20230815145023.1386003-5-okaya@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230815145023.1386003-1-okaya@kernel.org> References: <20230815145023.1386003-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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/eal/common/eal_common_memzone.c b/lib/eal/common/eal_common_memzone.c index 1f3e701499..6645ccfe83 100644 --- a/lib/eal/common/eal_common_memzone.c +++ b/lib/eal/common/eal_common_memzone.c @@ -22,6 +22,8 @@ #include "eal_private.h" #include "eal_memcfg.h" +static bool memzone_initialized; + /* Default count used until rte_memzone_max_set() is called */ #define DEFAULT_MAX_MEMZONE_COUNT 2560 @@ -426,6 +428,9 @@ rte_eal_memzone_init(void) struct rte_mem_config *mcfg; int ret = 0; + if (memzone_initialized) + return 0; + /* get pointer to global configuration */ mcfg = rte_eal_get_configuration()->mem_config; @@ -444,6 +449,8 @@ rte_eal_memzone_init(void) rte_rwlock_write_unlock(&mcfg->mlock); + memzone_initialized = true; + return ret; } -- 2.25.1