]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: Correct the NUMA node range checking
authorOsier Yang <jyang@redhat.com>
Wed, 22 Jan 2014 09:18:44 +0000 (17:18 +0800)
committerOsier Yang <jyang@redhat.com>
Thu, 23 Jan 2014 05:19:56 +0000 (13:19 +0800)
commitae2860b4c66b7bdfffb1dfa9ead4aa1b2d9aa2da
treea48c806f3010cf28a9336f37d4c94c02c6a763d7
parent7f2d27d1e334522ae4bc0b3713be06e1fb6bb0cc
util: Correct the NUMA node range checking

There are 2 issues here: First we shouldn't add "1" to the return
value of numa_max_node(), since the semanteme of the error message
was changed, it's not saying about the number of total NUMA nodes
anymore.  Second, the value of "bit" is the position of the first
bit which exceeds either numa_max_node() or NUMA_NUM_NODES, it can
be any number in the range, so saying "bigger than $bit" is quite
confused now. For example, assuming there is a NUMA machine which
has 10 NUMA nodes, and one specifies the "nodeset" as "0,5,88",
the error message will be like:

Nodeset is out of range, host cannot support NUMA node bigger than 88

It sounds like all NUMA node number less than 88 is fine, but
actually the maximum NUMA node number the machine supports is 9.

This patch fixes the issues by removing the addition with "1" and
simplifies the error message as "NUMA node $bit is out of range".
Also simplifies the comparision in the while loop by getting the
smaller one of numa_max_node() and NUMA_NUM_NODES up front.
src/util/virnuma.c