DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shahaf Shuler <shahafs@mellanox.com>
To: wenzhuo.lu@intel.com, jingjing.wu@intel.com, bernard.iremonger@intel.com
Cc: dev@dpdk.org, rasland@mellanox.com, thomas@monjalon.net,
	ferruh.yigit@intel.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v4 1/3] app/testpmd: fix mempool free on exit
Date: Sun,  7 Apr 2019 08:02:24 +0300	[thread overview]
Message-ID: <cacf4fc79730e6c2225636214d0d1d8a39b62316.1554613242.git.shahafs@mellanox.com> (raw)
In-Reply-To: <cover.1554613242.git.shahafs@mellanox.com>

Allocated mempools were never free. it is bad practice.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
---
 app/test-pmd/testpmd.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index aeaa74c989..b7f70b0c47 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -188,6 +188,8 @@ struct fwd_engine * fwd_engines[] = {
 	NULL,
 };
 
+struct rte_mempool *mempools[RTE_MAX_NUMA_NODES];
+
 struct fwd_config cur_fwd_config;
 struct fwd_engine *cur_fwd_eng = &io_fwd_engine; /**< IO mode by default. */
 uint32_t retry_enabled;
@@ -835,7 +837,7 @@ setup_extmem(uint32_t nb_mbufs, uint32_t mbuf_sz, bool huge)
 /*
  * Configuration initialisation done once at init time.
  */
-static void
+static struct rte_mempool *
 mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
 		 unsigned int socket_id)
 {
@@ -913,6 +915,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
 	} else if (verbose_level > 0) {
 		rte_mempool_dump(stdout, rte_mp);
 	}
+	return rte_mp;
 }
 
 /*
@@ -1130,14 +1133,18 @@ init_config(void)
 		uint8_t i;
 
 		for (i = 0; i < num_sockets; i++)
-			mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool,
-					 socket_ids[i]);
+			mempools[i] = mbuf_pool_create(mbuf_data_size,
+						       nb_mbuf_per_pool,
+						       socket_ids[i]);
 	} else {
 		if (socket_num == UMA_NO_CONFIG)
-			mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, 0);
+			mempools[0] = mbuf_pool_create(mbuf_data_size,
+						       nb_mbuf_per_pool, 0);
 		else
-			mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool,
-						 socket_num);
+			mempools[socket_num] = mbuf_pool_create
+							(mbuf_data_size,
+							 nb_mbuf_per_pool,
+							 socket_num);
 	}
 
 	init_port_config();
@@ -2394,6 +2401,7 @@ pmd_test_exit(void)
 	struct rte_device *device;
 	portid_t pt_id;
 	int ret;
+	int i;
 
 	if (test_done == 0)
 		stop_packet_forwarding();
@@ -2447,6 +2455,10 @@ pmd_test_exit(void)
 			return;
 		}
 	}
+	for (i = 0 ; i < RTE_MAX_NUMA_NODES ; i++) {
+		if (mempools[i])
+			rte_mempool_free(mempools[i]);
+	}
 
 	printf("\nBye...\n");
 }
-- 
2.12.0

  parent reply	other threads:[~2019-04-07  5:02 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01 10:34 [dpdk-dev] [PATCH 0/3] DMA map anonymous memory to eth devices Shahaf Shuler
2019-04-01 10:34 ` Shahaf Shuler
2019-04-01 10:34 ` [dpdk-dev] [PATCH 1/3] app/testpmd: fix mempool free on exit Shahaf Shuler
2019-04-01 10:34   ` Shahaf Shuler
2019-04-01 10:34 ` [dpdk-dev] [PATCH 2/3] app/testpmd: support creation of no IOVA contig mempools Shahaf Shuler
2019-04-01 10:34   ` Shahaf Shuler
2019-04-01 13:50   ` Burakov, Anatoly
2019-04-01 13:50     ` Burakov, Anatoly
2019-04-02  7:02     ` Shahaf Shuler
2019-04-02  7:02       ` Shahaf Shuler
2019-04-02 15:15       ` Burakov, Anatoly
2019-04-02 15:15         ` Burakov, Anatoly
2019-04-03  5:47         ` Shahaf Shuler
2019-04-03  5:47           ` Shahaf Shuler
2019-04-01 10:34 ` [dpdk-dev] [PATCH 3/3] app/testpmd: map anonymous memory for eth devices Shahaf Shuler
2019-04-01 10:34   ` Shahaf Shuler
2019-04-01 13:28   ` Burakov, Anatoly
2019-04-01 13:28     ` Burakov, Anatoly
2019-04-02  7:04     ` Shahaf Shuler
2019-04-02  7:04       ` Shahaf Shuler
2019-04-04  5:14 ` [dpdk-dev] [PATCH v2 0/3] DMA map anonymous memory to " Shahaf Shuler
2019-04-04  5:14   ` Shahaf Shuler
2019-04-04  5:14   ` [dpdk-dev] [PATCH v2 1/3] app/testpmd: fix mempool free on exit Shahaf Shuler
2019-04-04  5:14     ` Shahaf Shuler
2019-04-08 13:39     ` Iremonger, Bernard
2019-04-08 13:39       ` Iremonger, Bernard
2019-04-04  5:14   ` [dpdk-dev] [PATCH v2 2/3] app/testpmd: support creation of no IOVA contig mempools Shahaf Shuler
2019-04-04  5:14     ` Shahaf Shuler
2019-04-04  9:36     ` Burakov, Anatoly
2019-04-04  9:36       ` Burakov, Anatoly
2019-04-04  5:14   ` [dpdk-dev] [PATCH v2 3/3] app/testpmd: map anonymous memory for eth devices Shahaf Shuler
2019-04-04  5:14     ` Shahaf Shuler
2019-04-04  9:38     ` Burakov, Anatoly
2019-04-04  9:38       ` Burakov, Anatoly
2019-04-04 19:34   ` [dpdk-dev] [PATCH v3 0/3] DMA map anonymous memory to " Shahaf Shuler
2019-04-04 19:34     ` Shahaf Shuler
2019-04-04 19:34     ` [dpdk-dev] [PATCH v3 1/3] app/testpmd: fix mempool free on exit Shahaf Shuler
2019-04-04 19:34       ` Shahaf Shuler
2019-04-05 14:41       ` Ferruh Yigit
2019-04-05 14:41         ` Ferruh Yigit
2019-04-04 19:34     ` [dpdk-dev] [PATCH v3 2/3] app/testpmd: support creation of no IOVA contig mempools Shahaf Shuler
2019-04-04 19:34       ` Shahaf Shuler
2019-04-04 19:35     ` [dpdk-dev] [PATCH v3 3/3] app/testpmd: map anonymous memory for eth devices Shahaf Shuler
2019-04-04 19:35       ` Shahaf Shuler
2019-04-05  0:17     ` [dpdk-dev] [PATCH v3 0/3] DMA map anonymous memory to " Ferruh Yigit
2019-04-05  0:17       ` Ferruh Yigit
2019-04-07  5:02     ` [dpdk-dev] [PATCH v4 " Shahaf Shuler
2019-04-07  5:02       ` Shahaf Shuler
2019-04-07  5:02       ` Shahaf Shuler [this message]
2019-04-07  5:02         ` [dpdk-dev] [PATCH v4 1/3] app/testpmd: fix mempool free on exit Shahaf Shuler
2019-04-08 14:14         ` Iremonger, Bernard
2019-04-08 14:14           ` Iremonger, Bernard
2019-04-07  5:02       ` [dpdk-dev] [PATCH v4 2/3] app/testpmd: support creation of no IOVA contig mempools Shahaf Shuler
2019-04-07  5:02         ` Shahaf Shuler
2019-04-07  5:02       ` [dpdk-dev] [PATCH v4 3/3] app/testpmd: map anonymous memory for eth devices Shahaf Shuler
2019-04-07  5:02         ` Shahaf Shuler
2019-04-11 14:07       ` [dpdk-dev] [PATCH v4 0/3] DMA map anonymous memory to " Ferruh Yigit
2019-04-11 14:07         ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cacf4fc79730e6c2225636214d0d1d8a39b62316.1554613242.git.shahafs@mellanox.com \
    --to=shahafs@mellanox.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=rasland@mellanox.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).