This tunable indicates the current number of configured hugetlb pages in the kernel. Super user can dynamically request more (or free some pre-configured) hugepages. The allocation (or deallocation) of hugetlb pages is possible only if there are enough physically contiguous free pages in system (freeing of hugepages is possible only if there are enough hugetlb pages free that can be transferred back to regular memory pool). Pages that are used as hugetlb pages are reserved inside the kernel and cannot be used for other purposes.
Use the following command to dynamically allocate/deallocate hugepages:
echo 20 > /proc/sys/vm/nr_hugepages
This command will try to configure 20 hugepages in the system. The success or failure of allocation depends on the amount of physically contiguous memory that is preset in system at this time. System administrators may want to put this command in one of the local rc init files. This will enable the kernel to request hugepages early in the boot process (when the possibility of getting physical contiguous pages is still very high). In either case, administrators will want to verify the number of hugepages actually allocated by checking the tunable.