O'Reilly logo

KVM Virtualization Cookbook by Konstantin Ivanov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

To enable and set HugePages on the hypervisor and the KVM guest and use the virsh command to set various memory options, follow these steps:

  1. Check the current HugePages settings on the host OS:
root@kvm:~# cat /proc/meminfo | grep -i hugeAnonHugePages: 509952 kBHugePages_Total: 0HugePages_Free: 0HugePages_Rsvd: 0HugePages_Surp: 0Hugepagesize: 2048 kBroot@kvm:~#
  1. Connect to the KVM guest and check the current HugePages settings:
root@kvm1:~# cat /proc/meminfo | grep -i hugeHugePages_Total: 0HugePages_Free: 0HugePages_Rsvd: 0HugePages_Surp: 0Hugepagesize: 2048 kBroot@kvm1:~#
  1. Increase the size of the pool of HugePages from 0 to 25000 on the hypervisor and verify the following:
root@kvm:~# sysctl vm.nr_hugepages=25000 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required