event/octeontx2: improve chunk pool performance
authorPavan Nikhilesh <pbhagavatula@marvell.com>
Fri, 22 Nov 2019 15:44:28 +0000 (21:14 +0530)
committerJerin Jacob <jerinj@marvell.com>
Tue, 26 Nov 2019 06:49:30 +0000 (07:49 +0100)
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
drivers/event/octeontx2/otx2_tim_worker.h

index e8316a6..206ed43 100644 (file)
@@ -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.");
index 7b771fb..af2f864 100644 (file)
@@ -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;
 }