> From: Mattias Rönnblom [mailto:[email protected]]
> Sent: Monday, 19 February 2024 10.41
>
> Replace keeping PRNG state in a RTE_MAX_LCORE-sized static array of
> cache-aligned and RTE_CACHE_GUARDed struct instances with keeping the
> same state in a more cache-friendly lcore variable.
>
> Signed-off-by: Mattias Rönnblom <[email protected]>
> ---
[...]
> @@ -19,14 +20,12 @@ struct rte_rand_state {
> uint64_t z3;
> uint64_t z4;
> uint64_t z5;
> - RTE_CACHE_GUARD;
> -} __rte_cache_aligned;
> +};
>
> -/* One instance each for every lcore id-equipped thread, and one
> - * additional instance to be shared by all others threads (i.e., all
> - * unregistered non-EAL threads).
> - */
> -static struct rte_rand_state rand_states[RTE_MAX_LCORE + 1];
> +RTE_LCORE_VAR_HANDLE(struct rte_rand_state, rand_state);
> +
> +/* instance to be shared by all unregistered non-EAL threads */
> +static struct rte_rand_state unregistered_rand_state
> __rte_cache_aligned;
The unregistered_rand_state instance is still __rte_cache_aligned; consider
also adding an RTE_CACHE_GUARD to it.