dpdkhuge-pages

Whether the Hugepage Memory Reserved During Linux System Startup Is Continuous?


for example:

Create a HugeTLB pool for 1 GB pages by appending the following line to the kernel command-line options in the /etc/default/grub file as root:

default_hugepagesz=16G hugepagesz=1G

Does Linux ensure that the 16 GB hugepage memory is continuous?If not, is there any command to see if it is continuous or not?


Solution

  • Each hugetlbfs "page" is physically contiguous. From one page to the next, it is not guaranteed to be adjacent physically.

    The reason for allocating the larger page sizes (i.e., 1GB) at boot time is that memory gets more fragmented over time on a running system and finding large, contiguous chunks of memory for hugepage use becomes more rare.

    In answer to your question, if your architecture supports creating 16GB page sizes, then yes, the single 16GB page will be physically contiguous.

    Source https://www.kernel.org/doc/html/latest/admin-guide/mm/hugetlbpage.html#hugetlbpage:

    hugepagesz Specify a huge page size. Used in conjunction with hugepages parameter to preallocate a number of huge pages of the specified size. Hence, hugepagesz and hugepages are typically specified in pairs such as:

    hugepagesz=2M hugepages=512 hugepagesz can only be specified once on the command line for a specific huge page size. Valid huge page sizes are architecture dependent.

    However, this comment in the documentation leads me to believe that creating larger than 1GB page sizes is not typically supported:

    For example, x86 CPUs normally support 4K and 2M (1G if architecturally supported) page sizes