fstab “ignores” /dev/hugepages

Multiple guides for setting up gaming-focused virtual machines mention hugepages, and for good reason; Hugepages harshly cuts down the amount of cache misses, specifically in the translation lookaside buffer. Simply put, for most of the reasons you’d want a VM with a GPU, hugepages will probably improve performance.

That said, in a lot of examples for setting up hugepages, hugetlbfs is mounted at /dev/hugepages, and an entry for this is added to /etc/fstab. This is fine, right up until a restart. hugetlbfs isn’t mounted at boot, and /dev/hugepages is either not suitable for use as a mount point, or isn’t there at all.

This is because /dev is a rather “special” directory (it’s actually an entirely different filesystem), and udev rebuilds it every time the system starts. The solution is to put the hugetlbfs mountpoint elsewhere, such as /hugepages.