From: Peter Xu <peterx@redhat.com>
To: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Cc: quintela@redhat.com, leobras@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH 2/4] migration: check for rate_limit_max for RATE_LIMIT_DISABLED
Date: Tue, 10 Oct 2023 16:17:42 -0400 [thread overview]
Message-ID: <ZSWxZgq82NBD3Zwe@x1n> (raw)
In-Reply-To: <20230922065625.21848-3-elena.ufimtseva@oracle.com>
On Thu, Sep 21, 2023 at 11:56:23PM -0700, Elena Ufimtseva wrote:
> In migration rate limiting atomic operations are used
> to read the rate limit variables and transferred bytes and
> they are expensive. Check first if rate_limit_max is equal
> to RATE_LIMIT_DISABLED and return false immediately if so.
>
> Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
One trivial comment:
> ---
> migration/migration-stats.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/migration/migration-stats.c b/migration/migration-stats.c
> index 095d6d75bb..abc31483d5 100644
> --- a/migration/migration-stats.c
> +++ b/migration/migration-stats.c
> @@ -24,14 +24,14 @@ bool migration_rate_exceeded(QEMUFile *f)
> return true;
> }
>
> - uint64_t rate_limit_start = stat64_get(&mig_stats.rate_limit_start);
> - uint64_t rate_limit_current = migration_transferred_bytes(f);
> - uint64_t rate_limit_used = rate_limit_current - rate_limit_start;
> uint64_t rate_limit_max = stat64_get(&mig_stats.rate_limit_max);
Side note: since we have a helper, this can be migration_rate_get() too.
> -
> if (rate_limit_max == RATE_LIMIT_DISABLED) {
> return false;
> }
empty line would be nice.
> + uint64_t rate_limit_start = stat64_get(&mig_stats.rate_limit_start);
> + uint64_t rate_limit_current = migration_transferred_bytes(f);
> + uint64_t rate_limit_used = rate_limit_current - rate_limit_start;
> +
> if (rate_limit_max > 0 && rate_limit_used > rate_limit_max) {
> return true;
> }
> --
> 2.34.1
>
>
--
Peter Xu
next prev parent reply other threads:[~2023-10-10 20:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-22 6:56 [PATCH 0/4] multifd: various fixes Elena Ufimtseva
2023-09-22 6:56 ` [PATCH 1/4] multifd: wait for channels_ready before sending sync Elena Ufimtseva
2023-09-22 16:06 ` Fabiano Rosas
2023-09-22 23:18 ` Elena Ufimtseva
2023-09-22 6:56 ` [PATCH 2/4] migration: check for rate_limit_max for RATE_LIMIT_DISABLED Elena Ufimtseva
2023-09-22 17:38 ` Fabiano Rosas
2023-10-10 20:17 ` Peter Xu [this message]
2023-09-22 6:56 ` [PATCH 3/4] multifd: fix counters in multifd_send_thread Elena Ufimtseva
2023-09-22 18:13 ` Fabiano Rosas
2023-09-22 6:56 ` [PATCH 4/4] multifd: reset next_packet_len after sending pages Elena Ufimtseva
2023-09-22 18:32 ` Fabiano Rosas
2023-09-22 18:44 ` Fabiano Rosas
2023-09-22 14:18 ` [PATCH 0/4] multifd: various fixes Fabiano Rosas
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=ZSWxZgq82NBD3Zwe@x1n \
--to=peterx@redhat.com \
--cc=elena.ufimtseva@oracle.com \
--cc=leobras@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.