于 2011年05月12日 22:11, Eric Blake 写道:
On 05/12/2011 05:01 AM, Osier Yang wrote:
The new XML is like:
<memory model="interleave" nodeset="+0-4,8-12"/>
Compatibility with numactl syntax is an explicit non-goal.
numactl is just one platform specific impl. Compatibility
with numactl syntax is of no interest to the ESX or VirtualBox
drivers. The libvirt NUMA syntax should be using other
existing libvirt XML as the design compatibility target.
The syntax is actually not of numactl, but of libnuma, it
provides API numa_parse_nodestring() to parse the syntax,
The point we're trying to make is that the XML should _not_ match
libnuma, but should match<vcpu cpuset=...>. That is, the XML should
use 0-4,^3 to mean 0, 1, 2, 4; and then we need an internal translation
routine that converts ^ to + before calling libnuma functions.
"+" means different with "^".
The + indicates that the node numbers are relative to the process'
set of allowed nodes in its current cpuset.
A !N-N notation indicates the inverse of N-N, in other words all
nodes except N-N
The fact that we use libnuma under the hood is an implementation detail;
in the future we may find it easier to use some other mechanism to get
the same semantic effect, and that other mechanism may have yet some
third syntax. Therefore, it is better for libvirt to present consistent
syntax for all of its cpuset parsing, rather than to have two different
cpuset spellings based on what under-the-hood capability it is targetting.
Agree that we may use other mechanism to get the same sementic effect
in future, this is good consideration.
but the syntax is for NUMA *NODE* set, not *CPU* set, if we use same
syntax as cpuset for NUMA nodeset, then we lose some semantics, e.g.
for a "!2-4", we could use "^2,^3,^4" as an alternative solution,
though it looks quite uncomfortable, and the disadvantage is
we abort some smarter syntax, but the advantage is we follow the
syntax of cpuset, and actually they are just different at user
visible level, the final bitmask are same.