From: Zhang Chen <chen.zhang@intel.com >
To: "Dr . David Alan Gilbert" <dgilbert@redhat.com>,
Juan Quintela <quintela@redhat.com>,
Zhanghailiang <zhang.zhanghailiang@huawei.com>,
qemu-dev <qemu-devel@nongnu.org>
Cc: Zhang Chen <chen.zhang@intel.com>,
Jason Wang <jasowang@redhat.com>,
Zhang Chen <zhangckid@gmail.com>
Subject: [PATCH 3/3] migration/colo: Merge multi checkpoint request into one.
Date: Fri, 15 May 2020 12:28:18 +0800 [thread overview]
Message-ID: <20200515042818.17908-4-chen.zhang@intel.com> (raw)
In-Reply-To: <20200515042818.17908-1-chen.zhang@intel.com>
From: Zhang Chen <chen.zhang@intel.com>
When COLO guest occur issues, COLO-compare will catch lots of
different network packet and trigger notification multi times,
force periodic may happen at the same time. So this can be
efficient merge checkpoint request within COLO_CHECKPOINT_INTERVAL.
Signed-off-by: Zhang Chen <chen.zhang@intel.com>
---
migration/colo.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/migration/colo.c b/migration/colo.c
index d5bced22cb..e6a7d8c6e2 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -47,6 +47,9 @@ static COLOMode last_colo_mode;
#define COLO_BUFFER_BASE_SIZE (4 * 1024 * 1024)
+/* Default COLO_CHECKPOINT_INTERVAL is 1000 ms */
+#define COLO_CHECKPOINT_INTERVAL 1000
+
bool migration_in_colo_state(void)
{
MigrationState *s = migrate_get_current();
@@ -651,13 +654,20 @@ out:
void colo_checkpoint_notify(void *opaque)
{
MigrationState *s = opaque;
- int64_t next_notify_time;
+ int64_t now = qemu_clock_get_ms(QEMU_CLOCK_HOST);
- qemu_sem_post(&s->colo_checkpoint_sem);
- s->colo_checkpoint_time = qemu_clock_get_ms(QEMU_CLOCK_HOST);
- next_notify_time = s->colo_checkpoint_time +
- s->parameters.x_checkpoint_delay;
- timer_mod(s->colo_delay_timer, next_notify_time);
+ /*
+ * When COLO guest occur issues, COLO-compare will catch lots of
+ * different network packet and trigger notification multi times,
+ * force periodic may happen at the same time. So this can be
+ * efficient merge checkpoint request within COLO_CHECKPOINT_INTERVAL.
+ */
+ if (now > s->colo_checkpoint_time + COLO_CHECKPOINT_INTERVAL) {
+ qemu_sem_post(&s->colo_checkpoint_sem);
+ timer_mod(s->colo_delay_timer, now +
+ s->parameters.x_checkpoint_delay);
+ s->colo_checkpoint_time = now;
+ }
}
void migrate_start_colo_process(MigrationState *s)
--
2.17.1
next prev parent reply other threads:[~2020-05-15 4:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 4:28 [PATCH 0/3] migration/colo: Optimize COLO framework code Zhang Chen
2020-05-15 4:28 ` [PATCH 1/3] migration/colo: Optimize COLO boot code path Zhang Chen
2020-06-02 3:29 ` Zhanghailiang
2020-05-15 4:28 ` [PATCH 2/3] migration/colo: Update checkpoint time lately Zhang Chen
2020-06-02 6:20 ` Zhanghailiang
2020-05-15 4:28 ` Zhang Chen [this message]
2020-06-02 6:59 ` [PATCH 3/3] migration/colo: Merge multi checkpoint request into one Zhanghailiang
2020-06-03 9:11 ` Zhang, Chen
2020-06-03 9:38 ` Zhanghailiang
2020-06-04 6:35 ` Zhang, Chen
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=20200515042818.17908-4-chen.zhang@intel.com \
--to=chen.zhang@intel.com \
--cc=dgilbert@redhat.com \
--cc=jasowang@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=zhang.zhanghailiang@huawei.com \
--cc=zhangckid@gmail.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 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).