Check the Current Huge Page Size
Check the current default huge page size by inspection of
/proc/meminfo
:
# cat /proc/meminfo | grep Hugepagesize
Hugepagesize: 2048 kB
The method you use to allocate huge pages differs depending on the huge page size.
If the Huge Page Size is 2048 KB
If the huge page size is 2048 KB, allocate huge pages as follows:
1. Check the current huge page allocation by inspection of
/proc/meminfo
:
# cat /proc/meminfo | grep Huge
AnonHugePages: 2048 kB
ShmemHugePages: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 0 kB
In the output:
•
HugePages_Total
is the total number of huge pages available on the system.
•
HugePages_Free
is the number of huge pages that are free on the system.
2. If too few huge pages are free, allocate some extra huge pages. For example, to configure a
total of 1024 huge pages:
# sysctl -w vm.nr_hugepages=1024
3. To make this change persistent, update
/etc/sysctl.conf
:
# echo "vm.nr_hugepages = 1024" >> /etc/sysctl.conf
If the Huge Page Size is not 2048 KB
If the huge page size is not 2048 KB, instead allocate huge pages as follows:
1. Check the current 2048 KB huge page allocation by inspection of the files in
/sys/
kernel/mm/hugepages/hugepages-2048kB
:
# sh -c 'cd /sys/kernel/mm/hugepages/hugepages-2048kB; grep "" *'
free_hugepages:0
nr_hugepages:0
nr_hugepages_mempolicy:0
nr_overcommit_hugepages:0
resv_hugepages:0
surplus_hugepages:0
In the output:
Chapter 5: Tuning
UG1523 (v1.0) October 18, 2022
Alveo X3522 User Guide
27