[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4] libxl_set_memory_target: retain the same maxmem offset on top of the current target
On Wed, Feb 25, 2015 at 03:18:45PM +0000, Stefano Stabellini wrote: > In libxl_set_memory_target when setting the new maxmem, retain the same > offset on top of the current target. In the future the offset will > include memory allocated by QEMU for rom files. > > Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> > > --- > > Changes in v4: > - remove new_target_memkb <= 0 check. > > Changes in v3: > - move call to libxl__uuid2string and libxl_dominfo_dispose earlier; > - error out if new_target_memkb <= 0. > > Changes in v2: > - remove LIBXL_MAXMEM_CONSTANT from LIBXL__LOG_ERRNO. > --- > tools/libxl/libxl.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > index 52a783a..143cb3e 100644 > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -4681,6 +4681,12 @@ int libxl_set_memory_target(libxl_ctx *ctx, uint32_t > domid, > char *uuid; > xs_transaction_t t; > Should have: libxl_dominfo_init(&ptr); > + if (libxl_domain_info(ctx, &ptr, domid) < 0) > + goto out_no_transaction; > + > + uuid = libxl__uuid2string(gc, ptr.uuid); > + libxl_dominfo_dispose(&ptr); > + Since you need to use ptr later, you cannot dispose it here. You can safely call dispose before returning to caller. > retry_transaction: > t = xs_transaction_start(ctx->xsh); > > @@ -4756,7 +4762,7 @@ retry_transaction: > } > > if (enforce) { > - memorykb = new_target_memkb + videoram; > + memorykb = ptr.max_memkb - current_target_memkb + new_target_memkb; > rc = xc_domain_setmaxmem(ctx->xch, domid, memorykb); > if (rc != 0) { > LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, > @@ -4786,12 +4792,8 @@ retry_transaction: > goto out; > } > > - libxl_dominfo_init(&ptr); > - xcinfo2xlinfo(ctx, &info, &ptr); If I'm not mistaken, &info is only used here. I think you can delete info and relevant code all together. Wei. > - uuid = libxl__uuid2string(gc, ptr.uuid); > libxl__xs_write(gc, t, libxl__sprintf(gc, "/vm/%s/memory", uuid), > "%"PRIu32, new_target_memkb / 1024); > - libxl_dominfo_dispose(&ptr); > > out: > if (!xs_transaction_end(ctx->xsh, t, abort_transaction) > -- > 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |