[libvirt] [PATCH] libxl: allow libxl to calculate shadow mem requirements
Joao Martins
joao.m.martins at oracle.com
Wed Aug 3 09:51:03 UTC 2016
On 08/03/2016 12:49 AM, Jim Fehlig wrote:
> Long, long ago before libxl_get_required_shadow_memory() was
> made publicly available, its code was copied to the libxl driver
> for calculating shadow memory requirements of HVM domains.
>
> Long ago, libxl_get_required_shadow_memory() was exported in
> libxl_utils.h and included in xen-devel packages everywhere.
>
> Remove the copied code, which has become stale, and let libxl
> provode a proper shadow memory value.
>
> Signed-off-by: Jim Fehlig <jfehlig at suse.com>
> ---
>
> I ensured libxl_get_required_shadow_memory() was available
> as far back as Xen 4.4, which is the minimum version supported
> by the libxl driver.
Cool, and FWIW, Looks good to me:
Acked-by: Joao Martins <joao.m.martins at oracle.com>
(Also tested an HVM guest in which codepath goes through):
> src/libxl/libxl_conf.c | 13 ++++---------
> 1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index 1344604..5202ca1 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -493,15 +493,10 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
> }
> }
>
> - /*
> - * The following comment and calculation were taken directly from
> - * libxenlight's internal function libxl_get_required_shadow_memory():
> - *
> - * 256 pages (1MB) per vcpu, plus 1 page per MiB of RAM for the P2M map,
> - * plus 1 page per MiB of RAM to shadow the resident processes.
> - */
> - b_info->shadow_memkb = 4 * (256 * libxl_bitmap_count_set(&b_info->avail_vcpus) +
> - 2 * (b_info->max_memkb / 1024));
> + /* Allow libxl to calculate shadow memory requirements */
> + b_info->shadow_memkb =
> + libxl_get_required_shadow_memory(b_info->max_memkb,
> + b_info->max_vcpus);
> } else {
> /*
> * For compatibility with the legacy xen toolstack, default to pygrub
>
More information about the libvir-list
mailing list