On 3/31/25 13:03, Morten Brørup wrote:
Bulk requests to get or put objects in a mempool often vary in size.
A series of tests with pseudo random request sizes, to mitigate the
benefits of the CPU's dynamic branch predictor, was added.

Signed-off-by: Morten Brørup <m...@smartsharesystems.com>
Acked-by: Andrew Rybchenko <andrew.rybche...@oktetlabs.ru>

[snip]

@@ -181,9 +240,9 @@ per_lcore_mempool_test(void *arg)
        }
/* n_get_bulk and n_put_bulk must be divisors of n_keep */
-       if (((n_keep / n_get_bulk) * n_get_bulk) != n_keep)
+       if (!n_max_bulk && (((n_keep / n_get_bulk) * n_get_bulk) != n_keep))

IMHO n_max_bulk == 0 would be easier to read and as far as I remember
DPDK coding style recommends the same style.

                GOTO_ERR(ret, out);
-       if (((n_keep / n_put_bulk) * n_put_bulk) != n_keep)
+       if (!n_max_bulk && (((n_keep / n_put_bulk) * n_put_bulk) != n_keep))

same

                GOTO_ERR(ret, out);
        /* for constant n, n_get_bulk and n_put_bulk must be the same */
        if (use_constant_values && n_put_bulk != n_get_bulk)
@@ -200,7 +259,9 @@ per_lcore_mempool_test(void *arg)
        start_cycles = rte_get_timer_cycles();
while (time_diff/hz < TIME_S) {
-               if (!use_constant_values)
+               if (n_max_bulk)

n_max_bulk != 0
as DPDK coding style says

+                       ret = test_loop_random(mp, cache, n_keep, n_max_bulk);
+               else if (!use_constant_values)
                        ret = test_loop(mp, cache, n_keep, n_get_bulk, 
n_put_bulk);
                else if (n_get_bulk == 1)
                        ret = test_loop(mp, cache, n_keep, 1, 1);
@@ -261,9 +322,13 @@ launch_cores(struct rte_mempool *mp, unsigned int cores)
               use_external_cache ? external_cache_size : (unsigned int) 
mp->cache_size,
               cores,
               n_keep);
-       printf("n_get_bulk=%3u n_put_bulk=%3u constant_n=%u ",
-              n_get_bulk, n_put_bulk,
-              use_constant_values);
+       if (n_max_bulk)

same

+               printf("n_max_bulk=%3u ",
+                      n_max_bulk);
+       else
+               printf("n_get_bulk=%3u n_put_bulk=%3u constant_n=%u ",
+                      n_get_bulk, n_put_bulk,
+                      use_constant_values);
if (rte_mempool_avail_count(mp) != MEMPOOL_SIZE) {
                printf("mempool is not full\n");

[snip]

Reply via email to