[libvirt] [PATCH v3 3/3] virnuma: remove redundant check for numanode

Martin Kletzander mkletzan at redhat.com
Wed Oct 29 13:23:52 UTC 2014


On Wed, Oct 29, 2014 at 08:33:34PM +0800, Chen Fan wrote:
>Signed-off-by: Chen Fan <chen.fan.fnst at 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.

>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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20141029/b8bc3dd8/attachment-0001.sig>


More information about the libvir-list mailing list