mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
Replace sysctl.physinfo.sockets_per_node with more directly useful
sysctl.physinfo.nr_cpus. This also avoids miscalculation of sockets_per_node by Xen where the number of CPUs in the system is clipped. From: Elizabeth Kon <eak@us.ibm.com> Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
f475a034a7
commit
07f557cb63
13 files changed
+14
-50
No files matched your search
@@ -801,7 +801,7 @@ static PyObject *pyxc_physinfo(XcObject *self)
|
||||
"max_cpu_id", info.max_cpu_id,
|
||||
"threads_per_core", info.threads_per_core,
|
||||
"cores_per_socket", info.cores_per_socket,
|
||||
"sockets_per_node", info.sockets_per_node,
|
||||
"nr_cpus", info.nr_cpus,
|
||||
"total_memory", pages_to_kib(info.total_pages),
|
||||
"free_memory", pages_to_kib(info.free_pages),
|
||||
"scrub_memory", pages_to_kib(info.scrub_pages),
|
||||
|
||||
@@ -475,7 +475,7 @@ class XendNode:
|
||||
|
||||
cpu_info = {
|
||||
"nr_nodes": phys_info["nr_nodes"],
|
||||
"sockets_per_node": phys_info["sockets_per_node"],
|
||||
"nr_cpus": phys_info["nr_cpus"],
|
||||
"cores_per_socket": phys_info["cores_per_socket"],
|
||||
"threads_per_core": phys_info["threads_per_core"]
|
||||
}
|
||||
@@ -580,17 +580,9 @@ class XendNode:
|
||||
str='none\n'
|
||||
return str[:-1];
|
||||
|
||||
def count_cpus(self, pinfo):
|
||||
count=0
|
||||
node_to_cpu=pinfo['node_to_cpu']
|
||||
for i in range(0, pinfo['nr_nodes']):
|
||||
count+=len(node_to_cpu[i])
|
||||
return count;
|
||||
|
||||
def physinfo(self):
|
||||
info = self.xc.physinfo()
|
||||
|
||||
info['nr_cpus'] = self.count_cpus(info)
|
||||
info['cpu_mhz'] = info['cpu_khz'] / 1000
|
||||
|
||||
# physinfo is in KiB, need it in MiB
|
||||
@@ -600,7 +592,6 @@ class XendNode:
|
||||
|
||||
ITEM_ORDER = ['nr_cpus',
|
||||
'nr_nodes',
|
||||
'sockets_per_node',
|
||||
'cores_per_socket',
|
||||
'threads_per_core',
|
||||
'cpu_mhz',
|
||||
|
||||
@@ -1667,9 +1667,8 @@ def xm_info(args):
|
||||
"release": getVal(["software_version", "release"]),
|
||||
"version": getVal(["software_version", "version"]),
|
||||
"machine": getVal(["software_version", "machine"]),
|
||||
"nr_cpus": len(getVal(["host_CPUs"], [])),
|
||||
"nr_cpus": getVal(["cpu_configuration", "nr_cpus"]),
|
||||
"nr_nodes": getVal(["cpu_configuration", "nr_nodes"]),
|
||||
"sockets_per_node": getVal(["cpu_configuration", "sockets_per_node"]),
|
||||
"cores_per_socket": getVal(["cpu_configuration", "cores_per_socket"]),
|
||||
"threads_per_core": getVal(["cpu_configuration", "threads_per_core"]),
|
||||
"cpu_mhz": getCpuMhz(),
|
||||
|
||||