If you run some database,you probably heard about necessity to configure hugepages on your system.Databases will issue their requests either via mmap ( or shmat and shmget ) so from that point of view they are good candidate for huge pages.
If application uses
mmap system call,then hugepages will be accessible via
hugetlbfs and we need to mount in advance it using
# mount -t hugetlbfs none /mount_point
We can assign desired number of hugepages using two different methods
1. more known is editing /etc/sysctl.conf and assigning there number of huge pages we need
# sysctl -w vm.nr_hugepage=X
Where X cannot exceed maximum available system memory.Remember that we have talk about pages and if you reserve for example 256 huge pages, you will be reserving 512 MB of memory ( # cat /proc/meminfo | grep HugePages will give you information about HugePages size on your system )
To make above change persistent, add above parameter in /etc/sysctl.conf.
2. second option is to edit /boot/grub/grub.conf and add in kernel line
hugepages parameter, for example
With this, we will ensure that during early boot stage huge pages are reserved for usage.
Pay attention not to reserve the amount of memory space for hugepages which is bigger than available system memory.If you do that,very likely you will end with system panic,and booting to rescue mode and revert to original state would be an option,but you probably do not want to do to that on production system.