欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

qemu-kvm 使用内存的大页

程序员文章站 2022-06-04 08:51:46
...
来自EPT VPID <<kvm虚拟化技术与原理解析>>
挂载大页

mount -t hugetlbfs hugetlbfs /dev/hugepages/

设置大页数目

sysctl vm.nr_hugepages=1024


查看大页
主要
看HugePages_Total这四行,挂载设置前后有区别

cat /proc/meminfo


启动qemu虚拟机使用大页
-mem-path /dev/hugepages -mem-prealloc
/usr/libexec/qemu-kvm -m 1024 -smp 2  -hda /root/kvm/rhel65.img  -vnc 192.168.137.188:1 -mem-path /dev/hugepages -mem-prealloc -daemonize


vm使用大页后看到的host的上的效果
[code="java"]
# cat /proc/meminfo
MemTotal: 3908796 kB
MemFree: 116376 kB
Buffers: 99316 kB
Cached: 321756 kB
SwapCached: 8020 kB
Active: 789280 kB
Inactive: 669260 kB
Active(anon): 603672 kB
Inactive(anon): 444276 kB
Active(file): 185608 kB
Inactive(file): 224984 kB
Unevictable: 8440 kB
Mlocked: 8440 kB
SwapTotal: 2031608 kB
SwapFree: 2015532 kB
Dirty: 16 kB
Writeback: 0 kB
AnonPages: 1041816 kB
Mapped: 60468 kB
Shmem: 3048 kB
Slab: 109192 kB
SReclaimable: 64856 kB
SUnreclaim: 44336 kB
KernelStack: 3088 kB
PageTables: 45372 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 2937428 kB
Committed_AS: 2437948 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 167764 kB
VmallocChunk: 34359516772 kB
HardwareCorrupted: 0 kB
AnonHugePages: 354304 kB
HugePages_Total: 1024
HugePages_Free: 838
HugePages_Rsvd: 334
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 8192 kB
DirectMap2M: 2088960 kB
DirectMap1G: 2097152 kB
#
[/code]
相关标签: qemu