DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] power: use hugepage memory for queue list entry structure
@ 2024-12-19  7:53 Huisong Li
  0 siblings, 0 replies; only message in thread
From: Huisong Li @ 2024-12-19  7:53 UTC (permalink / raw)
  To: dev
  Cc: thomas, david.hunt, anatoly.burakov, sivaprasad.tummala,
	liuyonglong, lihuisong

The queue_list_entry structure data is used in rx_callback of io path
when enable PMD Power Management. However its memory is currently from
normal heap memory. For better performance, use hugepage memory to
replace it.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
 lib/power/rte_power_pmd_mgmt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c
index a2fff3b765..c7bf57a910 100644
--- a/lib/power/rte_power_pmd_mgmt.c
+++ b/lib/power/rte_power_pmd_mgmt.c
@@ -97,7 +97,7 @@ queue_list_find(const struct pmd_core_cfg *cfg, const union queue *q)
 }
 
 static int
-queue_list_add(struct pmd_core_cfg *cfg, const union queue *q)
+queue_list_add(struct pmd_core_cfg *cfg, const union queue *q, unsigned int lcore_id)
 {
 	struct queue_list_entry *qle;
 
@@ -105,10 +105,10 @@ queue_list_add(struct pmd_core_cfg *cfg, const union queue *q)
 	if (queue_list_find(cfg, q) != NULL)
 		return -EEXIST;
 
-	qle = malloc(sizeof(*qle));
+	qle = rte_zmalloc_socket(NULL, sizeof(*qle), RTE_CACHE_LINE_SIZE,
+				 rte_lcore_to_socket_id(lcore_id));
 	if (qle == NULL)
 		return -ENOMEM;
-	memset(qle, 0, sizeof(*qle));
 
 	queue_copy(&qle->queue, q);
 	TAILQ_INSERT_TAIL(&cfg->head, qle, next);
@@ -570,7 +570,7 @@ rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id,
 		goto end;
 	}
 	/* add this queue to the list */
-	ret = queue_list_add(lcore_cfg, &qdata);
+	ret = queue_list_add(lcore_cfg, &qdata, lcore_id);
 	if (ret < 0) {
 		POWER_LOG(DEBUG, "Failed to add queue to list: %s",
 				strerror(-ret));
@@ -664,7 +664,7 @@ rte_power_ethdev_pmgmt_queue_disable(unsigned int lcore_id,
 	 * callbacks can be freed. we're intentionally casting away const-ness.
 	 */
 	rte_free((void *)(uintptr_t)queue_cfg->cb);
-	free(queue_cfg);
+	rte_free(queue_cfg);
 
 	return 0;
 }
-- 
2.22.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-12-19  8:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-19  7:53 [PATCH] power: use hugepage memory for queue list entry structure Huisong Li

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).