diff options
author | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2010-09-23 19:01:37 +0100 |
---|---|---|
committer | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2010-09-23 19:01:37 +0100 |
commit | a39b5bc64ba246b851be97c07514a76e34689d4b (patch) | |
tree | 21a1863f62ca37f97745cf2754b28fd1c048f9c2 /tools | |
parent | ecb35ecb79e006b4713e9d3c2f4b1b0c68b9b65f (diff) | |
download | xen-a39b5bc64ba246b851be97c07514a76e34689d4b.tar.gz xen-a39b5bc64ba246b851be97c07514a76e34689d4b.tar.bz2 xen-a39b5bc64ba246b851be97c07514a76e34689d4b.zip |
libxl: Introduce a maximum limit for free_mem_slack (re (dom0) ballooning)
This fixes this message:
libxl: error: libxl.c:2921:libxl_set_memory_target new target
for dom0 is below the minimum threshold
which can occur spuriously if dom0_mem is specified and xl
autoballoning is left turned on.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libxl/libxl.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 31535af788..8b086b9123 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -2785,6 +2785,7 @@ static int libxl__fill_dom0_memory_info(libxl__gc *gc, uint32_t *target_memkb) char *free_mem_slack_path = "/local/domain/0/memory/freemem-slack"; xs_transaction_t t; libxl_ctx *ctx = libxl__gc_owner(gc); + uint32_t free_mem_slack = 0; retry_transaction: t = xs_transaction_start(ctx->xsh); @@ -2814,8 +2815,14 @@ retry_transaction: (uint32_t) info.current_memkb); libxl__xs_write(gc, t, max_path, "%"PRIu32, (uint32_t) info.max_memkb); - libxl__xs_write(gc, t, free_mem_slack_path, "%"PRIu32, (uint32_t) - (PAGE_TO_MEMKB(physinfo.total_pages) - info.current_memkb)); + + free_mem_slack = (uint32_t) (PAGE_TO_MEMKB(physinfo.total_pages) - + info.current_memkb); + /* From empirical measurements the free_mem_slack shouldn't be more + * than 15% of the total memory present on the system. */ + if (free_mem_slack > PAGE_TO_MEMKB(physinfo.total_pages) * 0.15) + free_mem_slack = PAGE_TO_MEMKB(physinfo.total_pages) * 0.15; + libxl__xs_write(gc, t, free_mem_slack_path, "%"PRIu32, free_mem_slack); *target_memkb = (uint32_t) info.current_memkb; rc = 0; |