About memory coherency

Nick Tian nick.tian at longsailingsemi.com
Tue Aug 9 04:54:37 CEST 2022


Hi
I am confusing about the "no-huge" option of DPDK 21.11.
The dpdk usage said: --no-huge:Use malloc instead of hugetlbfs.
But when I check the EAL source code, I found some code piece like this:
It's look like "no-huge" option will lead dpdk use memfd_create-->ftruncate-->mmap to reserve memory
and then provide to application with rte_malloc.
Am I right?
If so, what the "malloc" in "use malloc instead of hugelbfs" refer to?

EAL_memory.c
static int eal_legacy_hugepage_init(void){
....
 if (internal_conf->no_hugetlbfs) {
....
#ifdef MEMFD_SUPPORTED
  /* create a memfd and store it in the segment fd table */
  memfd = memfd_create("nohuge", 0);
......
   /* we got an fd - now resize it */
   if (ftruncate(memfd, internal_conf->memory) < 0) {
.....
    fd = memfd;
    flags = MAP_SHARED;   }
....
  prealloc_addr = msl->base_va;
  addr = mmap(prealloc_addr, mem_sz, PROT_READ | PROT_WRITE,
    flags | MAP_FIXED, fd, 0);
...


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/users/attachments/20220809/0c3f998c/attachment.htm>


More information about the users mailing list