xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wl@xen.org>
To: Costin Lupu <costin.lupu@cs.pub.ro>
Cc: xen-devel@lists.xenproject.org, Ian Jackson <iwj@xenproject.org>,
	Wei Liu <wl@xen.org>, Anthony PERARD <anthony.perard@citrix.com>
Subject: Re: [PATCH] tools/libs/light: Remove unnecessary libxl_list_vm() call
Date: Wed, 21 Apr 2021 10:08:08 +0000	[thread overview]
Message-ID: <20210421100808.fvl6argtpmstwrev@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <cf7c0f8869a087008fbe10888ebf96336b1ccb7b.1618837159.git.costin.lupu@cs.pub.ro>

On Mon, Apr 19, 2021 at 04:01:42PM +0300, Costin Lupu wrote:
> The removed lines were initially added by commit 314e64084d31, but the
> subsequent code which was using the nb_vm variable was later removed by
> commit 2ba368d13893, which makes these lines of code an overlooked
> reminiscence. Moreover, the call becomes very expensive when there is a
> considerable number of VMs (~1000 instances) running on the host.
> 

Nice catch.

> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>

Acked-by: Wei Liu <wl@xen.org>

> ---
>  tools/libs/light/libxl_create.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
> index 0c64268f66..43e9ba9c63 100644
> --- a/tools/libs/light/libxl_create.c
> +++ b/tools/libs/light/libxl_create.c
> @@ -578,7 +578,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
>                         uint32_t *domid, bool soft_reset)
>  {
>      libxl_ctx *ctx = libxl__gc_owner(gc);
> -    int ret, rc, nb_vm;
> +    int ret, rc;
>      const char *dom_type;
>      char *uuid_string;
>      char *dom_path, *vm_path, *libxl_path;
> @@ -586,7 +586,6 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
>      struct xs_permissions rwperm[1];
>      struct xs_permissions noperm[1];
>      xs_transaction_t t = 0;
> -    libxl_vminfo *vm_list;
>  
>      /* convenience aliases */
>      libxl_domain_create_info *info = &d_config->c_info;
> @@ -869,14 +868,6 @@ retry_transaction:
>                          ARRAY_SIZE(rwperm));
>      }
>  
> -    vm_list = libxl_list_vm(ctx, &nb_vm);
> -    if (!vm_list) {
> -        LOGD(ERROR, *domid, "cannot get number of running guests");
> -        rc = ERROR_FAIL;
> -        goto out;
> -    }
> -    libxl_vminfo_list_free(vm_list, nb_vm);
> -
>      xs_write(ctx->xsh, t, GCSPRINTF("%s/uuid", vm_path), uuid_string, strlen(uuid_string));
>      xs_write(ctx->xsh, t, GCSPRINTF("%s/name", vm_path), info->name, strlen(info->name));
>  
> -- 
> 2.20.1
> 


      reply	other threads:[~2021-04-21 10:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 13:01 Costin Lupu
2021-04-21 10:08 ` Wei Liu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210421100808.fvl6argtpmstwrev@liuwe-devbox-debian-v2 \
    --to=wl@xen.org \
    --cc=anthony.perard@citrix.com \
    --cc=costin.lupu@cs.pub.ro \
    --cc=iwj@xenproject.org \
    --cc=xen-devel@lists.xenproject.org \
    --subject='Re: [PATCH] tools/libs/light: Remove unnecessary libxl_list_vm() call' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).