All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Peter Xu <peterx@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 09:50:35 +0100	[thread overview]
Message-ID: <20180614085035.GB2616@work-vm> (raw)
In-Reply-To: <20180614022130.GQ15344@xz-mi>

* Peter Xu (peterx@redhat.com) wrote:
> 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?

I think it's harder;
This code is generic in migration.c where as the next patch is all
specific in ram.c; so we'd have to push a flag all the way down.
Also, the code later is very simple - every request it adds/removes
it posts/waits the semaphore - it's nice to keep that simple.

Dave

> -- 
> Peter Xu
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2018-06-14  8:50 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
2018-06-14  8:50     ` Dr. David Alan Gilbert [this message]
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=20180614085035.GB2616@work-vm \
    --to=dgilbert@redhat.com \
    --cc=jdenemar@redhat.com \
    --cc=peterx@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.