$ grep Huge /proc/meminfoHugePages_Total: 0HugePages_Free: 0HugePages_Rsvd: 0HugePages_Surp: 0Hugepagesize: 2048 kB
Hugepagesize is the size of one Hugepage, on most x86 or x86_64 machines, it's set to 2048 kB.
HugePages_Total is the number of Hugepages configured on the machine. In Redhat Linux, we can change this value by updating /etc/sysctl.conf
After updating, /sbin/sysctl -p may make the setting take effect, but it's better to restart the machine.echo "vm.nr_hugepages = 200" >> /etc/sysctl.conf
To confirm Hugepages is configured after rebooting,
$ grep Huge /proc/meminfoHugePages_Total: 200HugePages_Free: 200HugePages_Rsvd: 0HugePages_Surp: 0Hugepagesize: 2048 kB
By setting Hugepages to 200, we are telling linux to reserve 200 Hugepages. So the memory associated with Hugepages is: HugePages_Total x Huagepagesize = 200 x 2048kB = 400M.
The memory associated with Hugepages is always allocated, and it cannot be swapped out.
Before setting Hugepages,
After setting Hugepages, check memory usage again:$ grep Mem /proc/meminfoMemTotal: 1030940 kBMemFree: 861852 kB
We can see that the free memory dropped from 841M to 441M, after setting HugePages_Total to 200. The 400M memory is the associated to Hugepages, and it will always be allocated.$ grep Mem /proc/meminfoMemTotal: 1030940 kBMemFree: 452252 kB
We can use Hugepages to lock some memory for oracle SGA, so the SGA will never be paged out, thus improving the database performance.