Red Hat Training
A Red Hat training course is available for Red Hat Enterprise Linux
9.3.3. 域进程
如 Red Hat Enterprise Linux 中提供的,libvirt 使用 libnuma 为域进程设置内存绑定策略。这些策略的 nodeset 可以配置为 静态(在域 XML 中指定)或 自动 (通过查询 numad 进行配置)。有关如何在
<numatune>
标签中配置它们的示例,请参阅以下 XML 配置:
<numatune> <memory mode='strict' placement='auto'/> </numatune>
<numatune> <memory mode='strict' nodeset='0,2-3'/> </numatune>
libvirt 使用 sched_setaffinity(2) 为域进程设置 CPU 绑定策略。cpuset 选项可以 是静态的(在域 XML 中指定)或 自动 (通过查询 numad 进行配置)。有关如何在
<vcpu>
标签中配置它们的示例,请参阅以下 XML 配置:
<vcpu placement='auto'>8</vcpu>
<vcpu placement='static' cpuset='0-10,ˆ5'>8</vcpu>
您用于
<vcpu>
和 <numatune>
的放置模式间有隐式继承规则:
<numatune>
的放置模式默认为<vcpu>
相同的放置模式,如果指定了<nodeset>
,则为 static。- 同样,
<vcpu>
的放置模式默认为<numatune>
的同一放置模式,如果指定了<cpuset>
,则为 static。
这意味着,可以单独指定和定义域的 CPU 调优和内存调优,但也可以将其配置为依赖于其他的放置模式。
还可以使用 numad 配置您的系统,以引导选定的 vCPU 数量,而无需在启动时固定所有 vCPU。
例如:要在有 32 个 vCPU 的系统中只启用 8 个 vCPU,请配置类似如下的 XML:
<vcpu placement='auto' current='8'>32</vcpu>
注意
如需有关 vcpu 和 numatune http://libvirt.org/formatdomain.html#elementsCPUAllocation 的更多信息,请参阅以下 URL,以及 http://libvirt.org/formatdomain.html#elementsNUMATuning