Show Table of Contents
8.5. NUMA-Aware 内核同页合并
内核同页合并(KSM,Kernel SamePage Merging)允许虚拟机共享相同的内存页。KSM 可以探测出正在使用 NUMA 内存的系统并控制不同 NUMA 节点中的页面合并。
使用
sysfs /sys/kernel/mm/ksm/merge_across_nodes 参数来控制不同 NUMA 节点中的页面合并。在默认情况下,所有节点的页面都可以进行合并。当该参数被设置为 0 时,只有来自同一个节点的页面可以合并。
通常,除了系统内存过量的情况下,禁用 KSM 共享可以带来更好的运行性能。
重要
当 KSM 通过多个客机虚拟机在 NUMA 主机上的节点进行合并时,远端节点的客机和 CPU 在合并 KSM 页面的访问延迟将显著增加。
通过向客机 XML 添加以下命令,对虚拟机监控程序和客机共享页面的禁用进行指示:
<memoryBacking>
<nosharepages/>
</memoryBacking>
#
更多关于使用
<memoryBacking> 元素调试内存设置的信息,请参照第 7.3.2 节 “使用 virsh 调试内存”。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.