[Libvir] [RFC][PATCH 1/2] NUMA memory and topology patches

Richard W.M. Jones rjones at redhat.com
Tue Sep 25 09:01:59 UTC 2007


beth kon wrote:
> [PATCH 1/2] - add capability to access free memory information on each 
> NUMA cell.

+
+/* number of cells in the node will be saved for later use */
+int nbNodeCells;

This should be static I think.

+    if (xenDaemonNodeGetInfo(conn, &nodeInfo)) {
+    /* BETH - not sure what would be the appropriate error type. should 
I add one for xend? */
+        virXendError(conn, VIR_ERR_XEN_CALL, " cannot determine actual 
number of cells");
+        return -1;
+    }

It's certainly possible to add errors (to virterror) if none of the 
existing errors seem to fit.  But in this case I think it looks OK.

A bigger problem here is that I think the call to xenDaemonNodeGetInfo 
should happen inside xen_internal.c:xenHypervisorNodeGetCellsFreeMemory, 
something like this:

xenHypervisorNodeGetCellsFreeMemory (virConnectPtr conn, ....)
{
   static int nb_nodes = -1;

   if (nb_nodes == -1) {
     virNodeInfo info;
     if (xenDaemonNodeGetInfo (conn, &info) == -1) {
       ... (error) ...
     }
     nb_nodes = info->nodes;
   }

   ...
}

Note also the explicit test for == -1


The rest of the patch looks OK to me.

Rich.

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070925/01932145/attachment-0001.bin>


More information about the libvir-list mailing list