Huge Pages

Set hugepages permanently

Set the vm.nr_hugepages and vm.nr_hugepages_mempolicy values in /etc/sysctl.conf

  • These values are the “page count” as in how many pages you want.
  • Each page is 2mb in size so 15000 pages would be 30GB of memory.
sudo sysctl -a | grep -i huge
vm.hugepages_treat_as_movable = 0
vm.hugetlb_shm_group = 0
vm.nr_hugepages = 15000
vm.nr_hugepages_mempolicy = 15000
vm.nr_overcommit_hugepages = 0

Set hugepages temporarily

echo 15000 > /proc/sys/vm/nr_hugepages

Check current hugepage allocation

cat /proc/sys/vm/nr_hugepages OR sysctl -a | grep -i huge

If you found this useful please consider supporting the blog.


I use Fastmail to host my email for the blog. If you follow the link from this page you’ll get a 10% discount and I’ll get a little bit of break on my costs as well. It’s a win win.


Backblaze is a cloud backup solution for Mac and Windows desktops. I use it on my home computers, and if you sign up using the link on this page you get a free month of service through backblaze, and so do I. If you’re looking for a good backup solution give them a try!