On Wed, 2014-10-29 at 14:23 +0100, Martin Kletzander wrote:
On Wed, Oct 29, 2014 at 08:33:34PM +0800, Chen Fan wrote:
>Signed-off-by: Chen Fan <chen.fan.fnst(a)cn.fujitsu.com>
>---
> src/util/virnuma.c | 15 ---------------
> 1 file changed, 15 deletions(-)
>
I think this harmless check may prevent future problems (if
SetupMemoryPolicy is called from some new codepath. Either keep it
here or call virNumaNodesetIsAvailable() in the start of the function.
call
virNumaNodesetIsAvailable() in the start of the function will be
fine.
Thanks,
Chen
>diff --git a/src/util/virnuma.c b/src/util/virnuma.c
>index fbe8fd1..5a08049 100644
>--- a/src/util/virnuma.c
>+++ b/src/util/virnuma.c
>@@ -95,31 +95,16 @@ virNumaSetupMemoryPolicy(virDomainNumatunePtr numatune,
> int ret = -1;
> int bit = 0;
> size_t i;
>- int maxnode = 0;
> virBitmapPtr tmp_nodemask = NULL;
>
> tmp_nodemask = virDomainNumatuneGetNodeset(numatune, nodemask, -1);
> if (!tmp_nodemask)
> return 0;
>
>- if (numa_available() < 0) {
>- virReportError(VIR_ERR_INTERNAL_ERROR,
>- "%s", _("Host kernel is not aware of
NUMA."));
>- return -1;
>- }
>-
>- maxnode = numa_max_node();
>- maxnode = maxnode < NUMA_NUM_NODES ? maxnode : NUMA_NUM_NODES;
>-
> /* Convert nodemask to NUMA bitmask. */
> nodemask_zero(&mask);
> bit = -1;
> while ((bit = virBitmapNextSetBit(tmp_nodemask, bit)) >= 0) {
>- if (bit > maxnode) {
>- virReportError(VIR_ERR_INTERNAL_ERROR,
>- _("NUMA node %d is out of range"), bit);
>- return -1;
>- }
> nodemask_set(&mask, bit);
> }
>
>--
>1.9.3
>