DPDK usage discussions
 help / color / mirror / Atom feed
* Failure while allocating 1GB hugepages
@ 2024-05-10  9:33 Antonio Di Bacco
  2024-05-10 15:07 ` Dmitry Kozlyuk
  0 siblings, 1 reply; 7+ messages in thread
From: Antonio Di Bacco @ 2024-05-10  9:33 UTC (permalink / raw)
  To: users

I have 16 hugepages available per NUMA on a 4 NUMA system:

[user@node-1 hugepages]$ cat
/sys/devices/system/node/*/hugepages/hugepages-1048576kB/free_hugepages
16
16
16
16

Using the following program with dpdk 21.11, sometimes I can allocate
a few pages but most of the time I cannot. I tried also to remove
rtemap_* under /dev/hugepages.
rte_memzone_reserve_aligned is always supposed to use a new page?

#include <stdio.h>
#include <rte_eal.h>
#include <rte_memzone.h>

#include <rte_errno.h>
#include <unistd.h>

int main(int argc, char **argv)
{
    const struct rte_memzone *mz;
    int ret;
    printf("pid: %d\n", getpid());
    // Initialize EAL
    ret = rte_eal_init(argc, argv);
    if (ret < 0) {
        fprintf(stderr, "Error with EAL initialization\n");
        return -1;
    }

    for (int socket = 0; socket < 4; socket++)
    {
      for (int i = 0; i < 16; i++)
      {
        // Allocate memory using rte_memzone_reserve_aligned
        char name[32];
        sprintf(name, "my_memzone%d-%d", i, socket);
        mz = rte_memzone_reserve_aligned(name, 1ULL << 30, socket,
RTE_MEMZONE_IOVA_CONTIG, 1ULL << 30);

        if (mz == NULL) {
          printf("errno %s\n", rte_strerror(rte_errno));
          fprintf(stderr, "Memory allocation failed\n");
          rte_eal_cleanup();
          return -1;
      }

      printf("Memory allocated with name %s at socket %d physical
address: %p, addr %p addr64 %lx size: %zu\n", name, mz->socket_id,
(mz->iova), mz->addr, mz->addr_64, mz->len);
    }
    }

    // Clean up EAL
    rte_eal_cleanup();
    return 0;
}

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-06-04 22:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-10  9:33 Failure while allocating 1GB hugepages Antonio Di Bacco
2024-05-10 15:07 ` Dmitry Kozlyuk
2024-05-22 10:22   ` Antonio Di Bacco
2024-05-30 10:28     ` Antonio Di Bacco
2024-05-30 15:00       ` Dmitry Kozlyuk
2024-06-03 12:39         ` Antonio Di Bacco
2024-06-04 22:50           ` Dmitry Kozlyuk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).