[PATCH v3 04/14] test/stack: scale test based on number of cores

Stephen Hemminger
2026-01-22T00:54:29Z

This test uses loops to synchronize but has problems on systems
with high number of cores. Scale iterations to the number of
cores.

Fixes: 5e2e61b99e91 ("test/stack: check stack API")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test/test_stack.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/app/test/test_stack.c b/app/test/test_stack.c
index abc3114729..797c0a83ea 100644
--- a/app/test/test_stack.c
+++ b/app/test/test_stack.c
@@ -268,7 +268,8 @@ test_free_null(void)
return 0;
}

-#define NUM_ITERS_PER_THREAD 100000
+#define NUM_ITERS_BASE 100000u
+#define NUM_ITERS_MIN 1000u

struct test_args {
struct rte_stack *s;
@@ -280,9 +281,10 @@ static int
stack_thread_push_pop(__rte_unused void *args)
{
void *obj_table[MAX_BULK];
- int i;
+ unsigned int i, num_iters;

- for (i = 0; i < NUM_ITERS_PER_THREAD; i++) {
+ num_iters = test_scale_iterations(NUM_ITERS_BASE, NUM_ITERS_MIN);
+ for (i = 0; i < num_iters; i++) {
unsigned int num;

num = rte_rand() % MAX_BULK;
--
2.51.0