mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
[BALLOON] Make the domain0 ballooning logic in xend aware of pages that are on the page scrub list.
This fixes the case where crashing/restarting a domain can cause dom0 to balloon more than necessary. I changed the physinfo dictionary in Python to be in KiB, rather than MiB, to avoid accumulating ugly rounding errors. I tried to avoid changing units anywhere else. Signed-off-by: Charles Coffing <ccoffing@novell.com>
This commit is contained in:
1 parent
956c0afa80
commit
ecb13a587e
7 files changed
+64
-44
No files matched your search
@@ -582,6 +582,12 @@ static PyObject *pyxc_readconsolering(XcObject *self,
|
||||
}
|
||||
|
||||
|
||||
static unsigned long pages_to_kib(unsigned long pages)
|
||||
{
|
||||
return pages * (XC_PAGE_SIZE / 1024);
|
||||
}
|
||||
|
||||
|
||||
static PyObject *pyxc_pages_to_kib(XcObject *self, PyObject *args)
|
||||
{
|
||||
unsigned long pages;
|
||||
@@ -589,13 +595,7 @@ static PyObject *pyxc_pages_to_kib(XcObject *self, PyObject *args)
|
||||
if (!PyArg_ParseTuple(args, "l", &pages))
|
||||
return NULL;
|
||||
|
||||
return PyLong_FromUnsignedLong(pages * (XC_PAGE_SIZE / 1024));
|
||||
}
|
||||
|
||||
|
||||
static unsigned long pages_to_mb(unsigned long pages)
|
||||
{
|
||||
return (pages * (XC_PAGE_SIZE / 1024) + 1023) / 1024;
|
||||
return PyLong_FromUnsignedLong(pages_to_kib(pages));
|
||||
}
|
||||
|
||||
|
||||
@@ -618,13 +618,14 @@ static PyObject *pyxc_physinfo(XcObject *self)
|
||||
if(q>cpu_cap)
|
||||
*(q-1)=0;
|
||||
|
||||
return Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:i,s:s}",
|
||||
return Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:l,s:i,s:s}",
|
||||
"threads_per_core", info.threads_per_core,
|
||||
"cores_per_socket", info.cores_per_socket,
|
||||
"sockets_per_node", info.sockets_per_node,
|
||||
"nr_nodes", info.nr_nodes,
|
||||
"total_memory", pages_to_mb(info.total_pages),
|
||||
"free_memory", pages_to_mb(info.free_pages),
|
||||
"total_memory", pages_to_kib(info.total_pages),
|
||||
"free_memory", pages_to_kib(info.free_pages),
|
||||
"scrub_memory", pages_to_kib(info.scrub_pages),
|
||||
"cpu_khz", info.cpu_khz,
|
||||
"hw_caps", cpu_cap);
|
||||
}
|
||||
|
||||