[libvirt] [PATCH] Make nodeGetInfo report the correct number of NUMA nodes.

Daniel Veillard veillard at redhat.com
Fri Mar 12 11:32:55 UTC 2010


On Thu, Mar 11, 2010 at 06:00:56PM -0500, Chris Lalancette wrote:
> The nodeGetInfo code was always assuming that machine had a
> single NUMA node, which is not correct.  The good news is that
> libnuma gives us this information pretty easily, so let's
> properly report it.

  okay

> NOTE: With recent hardware starting to support CPU hot-add
> and hot-remove, both this code and the nodeCapsInitNUMA()
> code are quickly going to become obsolete.  We'll have to
> think of a more dynamic solution for dealing with NUMA
> nodes and CPUs that can come and go at will.

  well it makes little sense to refresh all the time,
I would expect some kind of signal we can hook on to detect
change in topology or capacities, though I don't see anything
on signal.h for this

> Signed-off-by: Chris Lalancette <clalance at redhat.com>
> ---
>  src/nodeinfo.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/src/nodeinfo.c b/src/nodeinfo.c
> index 0748602..8d7e055 100644
> --- a/src/nodeinfo.c
> +++ b/src/nodeinfo.c
> @@ -159,7 +159,11 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,
>  
>      nodeinfo->cpus = 0;
>      nodeinfo->mhz = 0;
> -    nodeinfo->nodes = nodeinfo->cores = 1;
> +    nodeinfo->cores = 1;
> +    if (numa_available() < 0)
> +        nodeinfo->nodes = 1;
> +    else
> +        nodeinfo->nodes = numa_max_node() + 1;
>  
>      /* NB: It is impossible to fill our nodes, since cpuinfo
>       * has no knowledge of NUMA nodes */

  ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list