This is an old revision of the document!


KVM

Get a performance boost by backing your KVM guest with hugetlbfs

# grep HUGETLB /boot/config-`uname -r`
CONFIG_HUGETLBFS=y
CONFIG_HUGETLB_PAGE=y
 mkdir /hugepages

Next add an entry to your /etc/fstab so that when you reboot your computer, your hugetlbfs will mount automatically. Your entry should look like the following.

 hugetlbfs       /hugepages  hugetlbfs       defaults        0 0
 echo 296 >  /proc/sys/vm/nr_hugepages

If you want this to be a permanent setup , you can also add it to your /etc/rc.local script so that it is always reserved on startup. To verify that you have large pages reserved inspect the contents of the /proc/meminfo file as follows.

# tail -n 5 /proc/meminfo 
HugePages_Total:   296
HugePages_Free:    296
HugePages_Rsvd:      0
HugePages_Surp:      0
Hugepagesize:     2048 kB
 qemu-system-x86_64 –hda windows.img –m 512 –mem-path /hugepages

You will probably notice a performance increase in your virtual machine. You can check that you’re actually using huge pages by inspecting the /proc/meminfo file again. For example, this is what mine looked like while running a kvm guest backed with the values in this post.

# tail -n 5 /proc/meminfo 
HugePages_Total:   296
HugePages_Free:     39
HugePages_Rsvd:      0
HugePages_Surp:      0
Hugepagesize:     2048 kB
kvm.1269899834.txt.gz · Last modified: 2010/03/29 23:57 by a
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready