On Thu, 11 Apr 2013, Ian Campbell wrote:
On Thu, 2013-04-11 at 05:09 +0100, Jim Fehlig wrote:
> > + /* This will fill xenstore info about free and dom0 memory - if missing,
> > + * should be called before starting first domain */
> > + if (libxl_get_free_memory(libxl_driver->ctx, &free_mem)) {
> > + VIR_ERROR(_("cannot get free memory info"));
> > + goto error;
> > + }
> >
>
> Should failure of libxl_get_free_memory() really be fatal and prevent
> the driver from loading?
I'm not sure it is intended to be called like this...
I think it is intended to be called as part of starting every domain, to
check if there is enough free memory for that domain, rather than
calling it once at start of day.
Actually libxl_get_free_memory is just meant to return to total amount
of free memory in the system. Can be called at any time.
As a side effect of libxl_get_free_memory, freemem-slack will be
written to xenstore if it wasn't before.
I think that it is OK to call it as Marek did in this patch, even though
might be nicer if we had a proper "libxl_initialize_memory_accounting"
function.