Skip to content
Advertisement

How to use 1GB hugepages in DPDK?

DPDK has two hugepage sizes:2MB hugepages and 1GB hugepages. I run the command below to use the 1GB hugepages:

JavaScript

However, when I run the command cat /proc/meminfo:

JavaScript

It still seems to use the 2MB hugepages. What should I do to use the 1GB hugepages?

Advertisement

Answer

The Hugepagesize field of /proc/meminfo is the default huge page size used by applications allocating huge pages. The available huge page sizes on your system can be seen with:

JavaScript

If you want to change the default huge page size, you can do it on the kernel command line with the default_hugepagesz parameter:

[same as hugepagesz=] The size of the default
HugeTLB page size. This is the size represented by
the legacy /proc/ hugepages APIs, used for SHM, and
default size when mounting hugetlbfs filesystems.
Defaults to the default architecture’s huge page size
if not specified.

This will define the size of the huge pages in the mounted hugetlbfs file system. Here is an example where the default size is 2M:

JavaScript

You can also specify the number of huge pages that you need by writing in the corresponding nr_hugepages file in /sys/kernel/mm/hugepages:

JavaScript

If your application starts early, it is also possible to specify the number of reserved huge pages on the kernel command line with hugepages parameter:

[HW,X86-32,IA-64] HugeTLB pages to allocate at boot.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement