Bug 530762

Summary: hugetlbfs support doesn't work
Product: [Fedora] Fedora Reporter: Sven Lankes <sven>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: berrange, clalance, crobinso, itamar, jforbes, markmc, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-10-25 23:27:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sven Lankes 2009-10-24 19:34:22 UTC
https://fedoraproject.org/wiki/Features/KVM_Huge_Page_Backed_Memory

contains this checklist to get hugetlbfs to work:

1. mount -t hugetlbfs hugetlbfs /dev/hugepages

  I have done this - /dev/hugepages didn't exist - I created it

2. Reserve some memory for huge pages - sysctl vm.nr_hugepages=516

  Done - I created 600 pages to fit a 1024 MB vm (on amd64):

  (from meminfo):

  HugePages_Total:     600
  HugePages_Free:      600
  HugePages_Rsvd:        0
  HugePages_Surp:        0

3. Run an existing KVM guest with libvirt

  done (I also restarted libvirtd)

4. Confirm the guest has booted correctly

  done

5. Confirm the guest is using hugepages by checking HugePages_Free in /proc/meminfo

  it doesn't - HugePages_Free is still 600

Selinux is disabled, my kvm-commandline:

/usr/bin/qemu-kvm -S -M pc-0.11 -m 1024 -smp 1 -name f11-x86_64 -uuid 61563594-3d8f-17c8-1b87-7d727689a9a0 -monitor unix:/var/lib/libvirt/qemu/f11-x86_64.monitor,server,nowait -boot c -drive file=,if=ide,media=cdrom,index=2 -drive file=/var/lib/libvirt/images/f1164.img,if=virtio,index=0,boot=on -net nic,macaddr=00:16:36:74:aa:8f,vlan=0,model=virtio,name=virtio.0 -net tap,fd=17,vlan=0,name=tap.0 -serial pty -parallel none -usb -usbdevice tablet -vnc 127.0.0.1:0 -vga cirrus

Comment 1 Daniel Berrangé 2009-10-25 23:27:50 UTC
Hugepages are not enabled by default for guests, so merely mounting hugetlbfs won't make them be used. You need to add the following to the guest

  <memoryBacking>
    <hugepages/>
  </memoryBacking>

To enable use of hugepages for RAM allocation.

Comment 2 Mark McLoughlin 2009-10-29 17:16:50 UTC
Sven, thanks for the report - I've added a note to "How to test" section in the wiki