From: Peter Xu <peterx@redhat.com>
To: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
Cc: qemu-devel@nongnu.org, quintela@redhat.com, jdenemar@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/3] migration: Wake rate limiting for urgent requests
Date: Thu, 14 Jun 2018 10:21:30 +0800 [thread overview]
Message-ID: <20180614022130.GQ15344@xz-mi> (raw)
In-Reply-To: <20180613102642.23995-3-dgilbert@redhat.com>
On Wed, Jun 13, 2018 at 11:26:41AM +0100, Dr. David Alan Gilbert (git) wrote:
[...]
> @@ -2932,10 +2943,24 @@ static void *migration_thread(void *opaque)
>
> migration_update_counters(s, current_time);
>
> + urgent = false;
> if (qemu_file_rate_limit(s->to_dst_file)) {
> - /* usleep expects microseconds */
> - g_usleep((s->iteration_start_time + BUFFER_DELAY -
> - current_time) * 1000);
> + /* Wait for a delay to do rate limiting OR
> + * something urgent to post the semaphore.
> + */
> + int ms = s->iteration_start_time + BUFFER_DELAY - current_time;
> + trace_migration_thread_ratelimit_pre(ms);
> + if (qemu_sem_timedwait(&s->rate_limit_sem, ms) == 0) {
> + /* We were worken by one or more urgent things but
> + * the timedwait will have consumed one of them.
> + * The service routine for the urgent wake will dec
> + * the semaphore itself for each item it consumes,
> + * so add this one we just eat back.
> + */
> + qemu_sem_post(&s->rate_limit_sem);
Is it possible that we just avoid eating that in the next patch? Then
we only provide a helper to "trigger an urgent request" but we only
consume the point here?
--
Peter Xu
next prev parent reply other threads:[~2018-06-14 2:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-13 10:26 [Qemu-devel] [PATCH 0/3] Postcopy bandwidth limiting Dr. David Alan Gilbert (git)
2018-06-13 10:26 ` [Qemu-devel] [PATCH 1/3] migration/postcopy: Add max-postcopy-bandwidth parameter Dr. David Alan Gilbert (git)
2018-06-14 2:18 ` Peter Xu
2018-06-13 10:26 ` [Qemu-devel] [PATCH 2/3] migration: Wake rate limiting for urgent requests Dr. David Alan Gilbert (git)
2018-06-14 2:21 ` Peter Xu [this message]
2018-06-14 8:50 ` Dr. David Alan Gilbert
2018-06-14 10:56 ` Peter Xu
2018-06-13 10:26 ` [Qemu-devel] [PATCH 3/3] migration/postcopy: Wake rate limit sleep on postcopy request Dr. David Alan Gilbert (git)
2018-06-14 10:56 ` Peter Xu
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=20180614022130.GQ15344@xz-mi \
--to=peterx@redhat.com \
--cc=dgilbert@redhat.com \
--cc=jdenemar@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.