All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: huangy81@chinatelecom.cn
Cc: Eduardo Habkost <ehabkost@redhat.com>,
	Juan Quintela <quintela@redhat.com>,
	qemu-devel@nongnu.org,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Chuan Zheng <zhengchuan@huawei.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 4/4] migration/dirtyrate: implement dirty-bitmap dirtyrate calculation
Date: Fri, 9 Jul 2021 14:32:57 -0400	[thread overview]
Message-ID: <YOiWWdF5cK3XKwml@t490s> (raw)
In-Reply-To: <d7079fd32152065b5301b88571b46bdf5dc62867.1624771216.git.huangy81@chinatelecom.cn>

On Sun, Jun 27, 2021 at 01:38:17PM +0800, huangy81@chinatelecom.cn wrote:
> +static void calculate_dirtyrate_dirty_bitmap(struct DirtyRateConfig config)
> +{
> +    int64_t msec = 0;
> +    int64_t start_time;
> +    uint64_t protect_flags = 0;
> +    uint64_t initially_set = 0;
> +    uint64_t protect_only = 0;
> +
> +    protect_flags = kvm_get_manual_dirty_log_protect();
> +    protect_only = KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE;
> +    initially_set =
> +        (KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE | KVM_DIRTY_LOG_INITIALLY_SET);
> +
> +    dirtyrate_global_dirty_log_start();
> +
> +    /* absense of migration */
> +    if (!(global_dirty_tracking & GLOBAL_DIRTY_MIGRATION)) {
> +        if ((protect_flags & initially_set) == initially_set) {
> +            /* skip the 1'round which return all 1 bits */
> +            memory_global_dirty_log_sync();
> +            /*
> +             * reset page protect manually and
> +             * start dirty tracking from now on
> +             **/
> +            dirtyrate_manual_reset_protect();
> +        }
> +    }

Right, clear dirty log is a bit tricky.

Wondering whether we can simplify this into something like:

  1. dirty_log_sync()
  2. if (manual_protect) reset_protect()
  3. record initial total dirty stats (total dirty stats updated when sync)
  4. sleep(SECONDS)
  5. dirty_log_sync()
  6. record final total dirty stats

Then I think it's not related to initial-all-set anymore. Do you think this
would work?

Thanks,

-- 
Peter Xu



  reply	other threads:[~2021-07-09 18:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-27  5:38 [PATCH 0/4] support dirtyrate measurement with dirty bitmap huangy81
     [not found] ` <cover.1624771216.git.huangy81@chinatelecom.cn>
2021-06-27  5:38   ` [PATCH 1/4] memory: introduce DIRTY_MEMORY_DIRTY_RATE dirty bits huangy81
2021-07-09 18:37     ` Peter Xu
2021-06-27  5:38   ` [PATCH 2/4] KVM: introduce kvm_get_manual_dirty_log_protect huangy81
2021-06-27  5:38   ` [PATCH 3/4] memory: introduce DIRTY_MEMORY_DIRTY_RATE dirty bits functions huangy81
2021-07-09 18:26     ` Peter Xu
2021-06-27  5:38   ` [PATCH 4/4] migration/dirtyrate: implement dirty-bitmap dirtyrate calculation huangy81
2021-07-09 18:32     ` Peter Xu [this message]
2021-07-09 18:20 ` [PATCH 0/4] support dirtyrate measurement with dirty bitmap Peter Xu
2021-07-11 15:27   ` Hyman Huang
2021-07-13 17:45     ` Peter Xu
2021-07-14 15:59       ` Hyman

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=YOiWWdF5cK3XKwml@t490s \
    --to=peterx@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=huangy81@chinatelecom.cn \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=zhengchuan@huawei.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.