DPDK patches and discussions
 help / color / mirror / Atom feed
From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, Pavan Nikhilesh <pbhagavatula@marvell.com>
Cc: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH v2 3/5] event/octeontx2: improve chunk pool performance
Date: Thu, 21 Nov 2019 12:43:16 +0530	[thread overview]
Message-ID: <20191121071319.1901-3-pbhagavatula@marvell.com> (raw)
In-Reply-To: <20191121071319.1901-1-pbhagavatula@marvell.com>

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Enable mempool cache for internal mempool to improve alloc performance.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 drivers/event/octeontx2/otx2_tim_evdev.c  |  4 ++--
 drivers/event/octeontx2/otx2_tim_worker.h | 15 ++++++++++++++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/event/octeontx2/otx2_tim_evdev.c b/drivers/event/octeontx2/otx2_tim_evdev.c
index e8316a6c7..206ed4331 100644
--- a/drivers/event/octeontx2/otx2_tim_evdev.c
+++ b/drivers/event/octeontx2/otx2_tim_evdev.c
@@ -124,6 +124,7 @@ tim_chnk_pool_create(struct otx2_tim_ring *tim_ring,
 	char pool_name[25];
 	int rc;
 
+	cache_sz /= rte_lcore_count();
 	/* Create chunk pool. */
 	if (rcfg->flags & RTE_EVENT_TIMER_ADAPTER_F_SP_PUT) {
 		mp_flags = MEMPOOL_F_SP_PUT | MEMPOOL_F_SC_GET;
@@ -138,10 +139,9 @@ tim_chnk_pool_create(struct otx2_tim_ring *tim_ring,
 		cache_sz = RTE_MEMPOOL_CACHE_MAX_SIZE;
 
 	if (!tim_ring->disable_npa) {
-		/* NPA need not have cache as free is not visible to SW */
 		tim_ring->chunk_pool = rte_mempool_create_empty(pool_name,
 				tim_ring->nb_chunks, tim_ring->chunk_sz,
-				0, 0, rte_socket_id(), mp_flags);
+				cache_sz, 0, rte_socket_id(), mp_flags);
 
 		if (tim_ring->chunk_pool == NULL) {
 			otx2_err("Unable to create chunkpool.");
diff --git a/drivers/event/octeontx2/otx2_tim_worker.h b/drivers/event/octeontx2/otx2_tim_worker.h
index daaaf8257..4549da4b5 100644
--- a/drivers/event/octeontx2/otx2_tim_worker.h
+++ b/drivers/event/octeontx2/otx2_tim_worker.h
@@ -144,8 +144,12 @@ static struct otx2_tim_ent *
 tim_clr_bkt(struct otx2_tim_ring * const tim_ring,
 	    struct otx2_tim_bkt * const bkt)
 {
+#define TIM_MAX_OUTSTANDING_OBJ		64
+	void *pend_chunks[TIM_MAX_OUTSTANDING_OBJ];
 	struct otx2_tim_ent *chunk;
 	struct otx2_tim_ent *pnext;
+	uint8_t objs = 0;
+
 
 	chunk = ((struct otx2_tim_ent *)(uintptr_t)bkt->first_chunk);
 	chunk = (struct otx2_tim_ent *)(uintptr_t)(chunk +
@@ -153,10 +157,19 @@ tim_clr_bkt(struct otx2_tim_ring * const tim_ring,
 	while (chunk) {
 		pnext = (struct otx2_tim_ent *)(uintptr_t)
 			((chunk + tim_ring->nb_chunk_slots)->w0);
-		rte_mempool_put(tim_ring->chunk_pool, chunk);
+		if (objs == TIM_MAX_OUTSTANDING_OBJ) {
+			rte_mempool_put_bulk(tim_ring->chunk_pool, pend_chunks,
+					     objs);
+			objs = 0;
+		}
+		pend_chunks[objs++] = chunk;
 		chunk = pnext;
 	}
 
+	if (objs)
+		rte_mempool_put_bulk(tim_ring->chunk_pool, pend_chunks,
+				objs);
+
 	return (struct otx2_tim_ent *)(uintptr_t)bkt->first_chunk;
 }
 
-- 
2.17.1


  parent reply	other threads:[~2019-11-21  7:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-20  4:56 [dpdk-dev] [PATCH 1/5] event/octeontx2: fix TIM HW race condition pbhagavatula
2019-11-20  4:56 ` [dpdk-dev] [PATCH 2/5] event/octeontx2: use opposite bucket to store current chunk pbhagavatula
2019-11-20  4:56 ` [dpdk-dev] [PATCH 3/5] event/octeontx2: improve chunk pool performance pbhagavatula
2019-11-20  4:56 ` [dpdk-dev] [PATCH 4/5] event/octeontx2: update SSO buffers based on timer count pbhagavatula
2019-11-20  4:56 ` [dpdk-dev] [PATCH 5/5] event/octeontx2: update start timestamp periodically pbhagavatula
2019-11-21  3:09 ` [dpdk-dev] [PATCH 1/5] event/octeontx2: fix TIM HW race condition Jerin Jacob
2019-11-21  7:13 ` [dpdk-dev] [PATCH v2 " pbhagavatula
2019-11-21  7:13   ` [dpdk-dev] [PATCH v2 2/5] event/octeontx2: use opposite bucket to store current chunk pbhagavatula
2019-11-21  7:13   ` pbhagavatula [this message]
2019-11-21  7:13   ` [dpdk-dev] [PATCH v2 4/5] event/octeontx2: update SSO buffers based on timer count pbhagavatula
2019-11-21  7:13   ` [dpdk-dev] [PATCH v2 5/5] event/octeontx2: update start timestamp periodically pbhagavatula

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=20191121071319.1901-3-pbhagavatula@marvell.com \
    --to=pbhagavatula@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.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).