[2/2] examples: use mempool cache for vector pool

Message ID 20220523095954.3181-2-pbhagavatula@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [1/2] app/eventdev: use mempool cache for vector pool |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Pavan Nikhilesh Bhagavatula May 23, 2022, 9:59 a.m. UTC
  From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Use mempool cache for vector mempool as vectors are freed by the Tx
routine, also increase the minimum pool size to 512 to avoid resource
contention on Rx.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 examples/ipsec-secgw/event_helper.c | 8 ++++----
 examples/l2fwd-event/main.c         | 4 +++-
 examples/l3fwd/main.c               | 4 +++-
 3 files changed, 10 insertions(+), 6 deletions(-)
  

Comments

Jerin Jacob June 10, 2022, 1:46 p.m. UTC | #1
On Mon, May 23, 2022 at 3:30 PM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Use mempool cache for vector mempool as vectors are freed by the Tx
> routine, also increase the minimum pool size to 512 to avoid resource
> contention on Rx.
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>


Acked-by: Jerin Jacob <jerinj@marvell.com>

> ---
>  examples/ipsec-secgw/event_helper.c | 8 ++++----
>  examples/l2fwd-event/main.c         | 4 +++-
>  examples/l3fwd/main.c               | 4 +++-
>  3 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/examples/ipsec-secgw/event_helper.c b/examples/ipsec-secgw/event_helper.c
> index 172ab8e716..b36f20a3fd 100644
> --- a/examples/ipsec-secgw/event_helper.c
> +++ b/examples/ipsec-secgw/event_helper.c
> @@ -820,12 +820,12 @@ eh_rx_adapter_configure(struct eventmode_conf *em_conf,
>                                    em_conf->ext_params.vector_size) + 1;
>                         if (per_port_pool)
>                                 nb_elem = nb_ports * nb_elem;
> +                       nb_elem = RTE_MAX(512U, nb_elem);
>                 }
> -
> +               nb_elem += rte_lcore_count() * 32;
>                 vector_pool = rte_event_vector_pool_create(
> -                       "vector_pool", nb_elem, 0,
> -                       em_conf->ext_params.vector_size,
> -                       socket_id);
> +                       "vector_pool", nb_elem, 32,
> +                       em_conf->ext_params.vector_size, socket_id);
>                 if (vector_pool == NULL) {
>                         EH_LOG_ERR("failed to create event vector pool");
>                         return -ENOMEM;
> diff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c
> index dcc72f3f1e..44303d10c2 100644
> --- a/examples/l2fwd-event/main.c
> +++ b/examples/l2fwd-event/main.c
> @@ -678,8 +678,10 @@ main(int argc, char **argv)
>
>                 vec_size = rsrc->evt_vec.size;
>                 nb_vec = (nb_mbufs + vec_size - 1) / vec_size;
> +               nb_vec = RTE_MAX(512U, nb_vec);
> +               nb_vec += rte_lcore_count() * 32;
>                 rsrc->evt_vec_pool = rte_event_vector_pool_create(
> -                       "vector_pool", nb_vec, 0, vec_size, rte_socket_id());
> +                       "vector_pool", nb_vec, 32, vec_size, rte_socket_id());
>                 if (rsrc->evt_vec_pool == NULL)
>                         rte_panic("Cannot init event vector pool\n");
>         }
> diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
> index a629198223..896a347db3 100644
> --- a/examples/l3fwd/main.c
> +++ b/examples/l3fwd/main.c
> @@ -1006,9 +1006,11 @@ init_mem(uint16_t portid, unsigned int nb_mbuf)
>
>                         nb_vec = (nb_mbuf + evt_rsrc->vector_size - 1) /
>                                  evt_rsrc->vector_size;
> +                       nb_vec = RTE_MAX(512U, nb_vec);
> +                       nb_vec += rte_lcore_count() * 32;
>                         snprintf(s, sizeof(s), "vector_pool_%d", portid);
>                         vector_pool[portid] = rte_event_vector_pool_create(
> -                               s, nb_vec, 0, evt_rsrc->vector_size, socketid);
> +                               s, nb_vec, 32, evt_rsrc->vector_size, socketid);
>                         if (vector_pool[portid] == NULL)
>                                 rte_exit(EXIT_FAILURE,
>                                          "Failed to create vector pool for port %d\n",
> --
> 2.25.1
>
  

Patch

diff --git a/examples/ipsec-secgw/event_helper.c b/examples/ipsec-secgw/event_helper.c
index 172ab8e716..b36f20a3fd 100644
--- a/examples/ipsec-secgw/event_helper.c
+++ b/examples/ipsec-secgw/event_helper.c
@@ -820,12 +820,12 @@  eh_rx_adapter_configure(struct eventmode_conf *em_conf,
 				   em_conf->ext_params.vector_size) + 1;
 			if (per_port_pool)
 				nb_elem = nb_ports * nb_elem;
+			nb_elem = RTE_MAX(512U, nb_elem);
 		}
-
+		nb_elem += rte_lcore_count() * 32;
 		vector_pool = rte_event_vector_pool_create(
-			"vector_pool", nb_elem, 0,
-			em_conf->ext_params.vector_size,
-			socket_id);
+			"vector_pool", nb_elem, 32,
+			em_conf->ext_params.vector_size, socket_id);
 		if (vector_pool == NULL) {
 			EH_LOG_ERR("failed to create event vector pool");
 			return -ENOMEM;
diff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c
index dcc72f3f1e..44303d10c2 100644
--- a/examples/l2fwd-event/main.c
+++ b/examples/l2fwd-event/main.c
@@ -678,8 +678,10 @@  main(int argc, char **argv)
 
 		vec_size = rsrc->evt_vec.size;
 		nb_vec = (nb_mbufs + vec_size - 1) / vec_size;
+		nb_vec = RTE_MAX(512U, nb_vec);
+		nb_vec += rte_lcore_count() * 32;
 		rsrc->evt_vec_pool = rte_event_vector_pool_create(
-			"vector_pool", nb_vec, 0, vec_size, rte_socket_id());
+			"vector_pool", nb_vec, 32, vec_size, rte_socket_id());
 		if (rsrc->evt_vec_pool == NULL)
 			rte_panic("Cannot init event vector pool\n");
 	}
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index a629198223..896a347db3 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -1006,9 +1006,11 @@  init_mem(uint16_t portid, unsigned int nb_mbuf)
 
 			nb_vec = (nb_mbuf + evt_rsrc->vector_size - 1) /
 				 evt_rsrc->vector_size;
+			nb_vec = RTE_MAX(512U, nb_vec);
+			nb_vec += rte_lcore_count() * 32;
 			snprintf(s, sizeof(s), "vector_pool_%d", portid);
 			vector_pool[portid] = rte_event_vector_pool_create(
-				s, nb_vec, 0, evt_rsrc->vector_size, socketid);
+				s, nb_vec, 32, evt_rsrc->vector_size, socketid);
 			if (vector_pool[portid] == NULL)
 				rte_exit(EXIT_FAILURE,
 					 "Failed to create vector pool for port %d\n",