[root@humbles-lap qemu_upstream]# cat /proc/meminfo |grep -i huge
AnonHugePages: 434176 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB ======; 2M
[root@humbles-lap qemu_upstream]#
[root@humbles-lap qemu_upstream]# sysctl -a |grep -i huge
vm.nr_hugepages = 0
vm.nr_hugepages_mempolicy = 0
vm.hugetlb_shm_group = 0
vm.hugepages_treat_as_movable = 0
vm.nr_overcommit_hugepages = 0
My guest have '512M' of memory , so I decided to give <strong>"256" ( total 256*2M=512) as the number of hugepages
[root@humbles-lap qemu_upstream]# sysctl vm.nr_hugepages=256
vm.nr_hugepages = 256
[root@humbles-lap qemu_upstream]#
[root@humbles-lap qemu_upstream]# sysctl -a |grep -i huge
vm.nr_hugepages = 256
vm.nr_hugepages_mempolicy = 256
vm.hugetlb_shm_group = 0
vm.hugepages_treat_as_movable = 0
vm.nr_overcommit_hugepages = 0
[root@humbles-lap qemu_upstream]#
So, hugepage assignment reflected here:
[root@humbles-lap qemu_upstream]# cat /proc/meminfo |grep -i huge
AnonHugePages: 450560 kB
HugePages_Total: 256
HugePages_Free: 256
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
[root@humbles-lap qemu_upstream]#
Once you assigned hugepages, you need to restart 'libvirtd" service...
[root@humbles-lap hpages]# service libvirtd restart
Stopping libvirtd daemon: [ OK ]
Starting libvirtd daemon: [ OK ]
[root@humbles-lap hpages]#
Check mount point for 'existence' of a directory as shown below:
[root@humbles-lap qemu_upstream]# cd /dev/hpages/
[root@humbles-lap hpages]# ls
libvirt
[root@humbles-lap hpages]# cd libvirt/
[root@humbles-lap libvirt]# ls
qemu
[root@humbles-lap libvirt]# cd qemu/
[root@humbles-lap qemu]# ls
[root@humbles-lap qemu]#
With the current configuration, I have NOT specified to have 'hugepage' backed memory for my guest..
[root@humbles-lap qemu_upstream]# cat /etc/libvirt/qemu/rhel5.4-x86_64-kvm.xml |grep -i memory
memory;524288/memory;
currentMemory;524288/currentMemory;
[root@humbles-lap qemu_upstream]#
I edited my guest xml configuration to say, this guest memory is backed with "HUGEPAGES"..
[root@humbles-lap qemu_upstream]# cat /etc/libvirt/qemu/rhel5.4-x86_64-kvm.xml|grep -i memory -A 2
memory;524288/memory;
currentMemory;524288/currentMemory;
;memoryBacking;
hugepages/;
/memoryBacking;
vcpu;2/vcpu;
os;
[root@humbles-lap qemu_upstream]#
Started guest:
[root@humbles-lap qemu_upstream]# virsh create /etc/libvirt/qemu/rhel5.4-x86_64-kvm.xml
Domain rhel5.4-x86_64-kvm created from /etc/libvirt/qemu/rhel5.4-x86_64-kvm.xml
[root@humbles-lap qemu_upstream]# virsh list
Id Name State
----------------------------------
1 rhel5.4-x86_64-kvm running
[root@humbles-lap qemu_upstream]#
Now, check 'meminfo' in HOST system to know whether "HUGEPAGES" are used with GUESTS..
[root@humbles-lap qemu_upstream]# cat /proc/meminfo |grep -i huge
AnonHugePages: 483328 kB
HugePages_Total: 256
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
[root@humbles-lap qemu_upstream]#