[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:
kaf24@firebug.cl.cam.ac.uk committed 2006-06-27 12:03:46 +01:00
1 parent 956c0afa80
commit ecb13a587e
7 files changed
+64 -44

No files matched your search

+11 -10
View File
@@ -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);
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.