Skip to content

Commit

Permalink
mempool: test performance with larger bursts
Browse files Browse the repository at this point in the history
Bursts of up to 128 packets are not uncommon, so increase the maximum
tested get and put burst sizes from 32 to 128.

Some applications keep more than 512 objects, so increase the maximum
number of kept objects from 512 to 4096.
This exceeds the typical mempool cache size of 512 objects, so the test
also exercises the mempool driver.

Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
MortenBroerup authored and ovsrobot committed Jan 21, 2024
1 parent 515e1a4 commit d466241
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions app/test/test_mempool_perf.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2010-2014 Intel Corporation
* Copyright(c) 2022 SmartShare Systems
* Copyright(c) 2022-2024 SmartShare Systems
*/

#include <string.h>
Expand Down Expand Up @@ -54,22 +54,24 @@
*
* - Bulk size (*n_get_bulk*, *n_put_bulk*)
*
* - Bulk get from 1 to 32
* - Bulk put from 1 to 32
* - Bulk get and put from 1 to 32, compile time constant
* - Bulk get from 1 to 128
* - Bulk put from 1 to 128
* - Bulk get and put from 1 to 128, compile time constant
*
* - Number of kept objects (*n_keep*)
*
* - 32
* - 128
* - 512
* - 1024
* - 4096
*/

#define N 65536
#define TIME_S 5
#define MEMPOOL_ELT_SIZE 2048
#define MAX_KEEP 512
#define MEMPOOL_SIZE ((rte_lcore_count()*(MAX_KEEP+RTE_MEMPOOL_CACHE_MAX_SIZE))-1)
#define MAX_KEEP 4096
#define MEMPOOL_SIZE ((rte_lcore_count()*(MAX_KEEP+RTE_MEMPOOL_CACHE_MAX_SIZE*2))-1)

/* Number of pointers fitting into one cache line. */
#define CACHE_LINE_BURST (RTE_CACHE_LINE_SIZE / sizeof(uintptr_t))
Expand Down Expand Up @@ -204,6 +206,8 @@ per_lcore_mempool_test(void *arg)
CACHE_LINE_BURST, CACHE_LINE_BURST);
else if (n_get_bulk == 32)
ret = test_loop(mp, cache, n_keep, 32, 32);
else if (n_get_bulk == 128)
ret = test_loop(mp, cache, n_keep, 128, 128);
else
ret = -1;

Expand Down Expand Up @@ -289,9 +293,9 @@ launch_cores(struct rte_mempool *mp, unsigned int cores)
static int
do_one_mempool_test(struct rte_mempool *mp, unsigned int cores)
{
unsigned int bulk_tab_get[] = { 1, 4, CACHE_LINE_BURST, 32, 0 };
unsigned int bulk_tab_put[] = { 1, 4, CACHE_LINE_BURST, 32, 0 };
unsigned int keep_tab[] = { 32, 128, 512, 0 };
unsigned int bulk_tab_get[] = { 1, 4, CACHE_LINE_BURST, 32, 128, 0 };
unsigned int bulk_tab_put[] = { 1, 4, CACHE_LINE_BURST, 32, 128, 0 };
unsigned int keep_tab[] = { 32, 128, 512, 1024, 4096, 0 };
unsigned *get_bulk_ptr;
unsigned *put_bulk_ptr;
unsigned *keep_ptr;
Expand All @@ -301,6 +305,9 @@ do_one_mempool_test(struct rte_mempool *mp, unsigned int cores)
for (put_bulk_ptr = bulk_tab_put; *put_bulk_ptr; put_bulk_ptr++) {
for (keep_ptr = keep_tab; *keep_ptr; keep_ptr++) {

if (*keep_ptr < *get_bulk_ptr || *keep_ptr < *put_bulk_ptr)
continue;

use_constant_values = 0;
n_get_bulk = *get_bulk_ptr;
n_put_bulk = *put_bulk_ptr;
Expand Down

0 comments on commit d466241

Please sign in to comment.