On Tue, 19 Oct 2021 01:07:02 +0530
Harman Kalra <hka...@marvell.com> wrote:

> +     /* Detect if DPDK malloc APIs are ready to be used. */
> +     mem_allocator = rte_malloc_is_ready();
> +     if (mem_allocator)
> +             intr_handle = rte_zmalloc(NULL, sizeof(struct rte_intr_handle),
> +                                       0);
> +     else
> +             intr_handle = calloc(1, sizeof(struct rte_intr_handle));

This is problematic way to do this.
The reason to use rte_malloc vs malloc should be determined by usage.

If the pointer will be shared between primary/secondary process then
it has to be in hugepages (ie rte_malloc). If it is not shared then
then use regular malloc.

But what you have done is created a method which will be
a latent bug for anyone using primary/secondary process.

Either:
    intr_handle is not allowed to be used in secondary.
      Then always use malloc().
Or.
    intr_handle can be used by both primary and secondary.
    Then always use rte_malloc().
    Any code path that allocates intr_handle before pool is
    ready is broken.

Reply via email to