]>
Commit | Line | Data |
---|---|---|
a36bda14 FE |
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | From: Fiona Ebner <f.ebner@proxmox.com> | |
3 | Date: Thu, 28 Sep 2023 11:19:14 +0200 | |
4 | Subject: [PATCH] migration states: workaround snapshot performance regression | |
5 | ||
6 | Commit 813cd616 ("migration: Use migration_transferred_bytes() to | |
7 | calculate rate_limit") introduced a prohibitive performance regression | |
8 | when taking a snapshot [0]. The reason turns out to be the flushing | |
9 | done by migration_transferred_bytes() | |
10 | ||
11 | Just use a _noflush version of the relevant function as a workaround | |
12 | until upstream fixes the issue. This is inspired by a not-applied | |
13 | upstream series [1], but doing the very minimum to avoid the | |
14 | regression. | |
15 | ||
16 | [0]: https://gitlab.com/qemu-project/qemu/-/issues/1821 | |
17 | [1]: https://lists.nongnu.org/archive/html/qemu-devel/2023-05/msg07708.html | |
18 | ||
19 | Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> | |
20 | --- | |
21 | migration/migration-stats.c | 16 +++++++++++++++- | |
22 | 1 file changed, 15 insertions(+), 1 deletion(-) | |
23 | ||
24 | diff --git a/migration/migration-stats.c b/migration/migration-stats.c | |
25 | index 095d6d75bb..8073c8ebaa 100644 | |
26 | --- a/migration/migration-stats.c | |
27 | +++ b/migration/migration-stats.c | |
28 | @@ -18,6 +18,20 @@ | |
29 | ||
30 | MigrationAtomicStats mig_stats; | |
31 | ||
32 | +/* | |
33 | + * Same as migration_transferred_bytes below, but using the _noflush | |
34 | + * variant of qemu_file_transferred() to avoid a performance | |
35 | + * regression in migration_rate_exceeded(). | |
36 | + */ | |
37 | +static uint64_t migration_transferred_bytes_noflush(QEMUFile *f) | |
38 | +{ | |
39 | + uint64_t multifd = stat64_get(&mig_stats.multifd_bytes); | |
40 | + uint64_t qemu_file = qemu_file_transferred_noflush(f); | |
41 | + | |
42 | + trace_migration_transferred_bytes(qemu_file, multifd); | |
43 | + return qemu_file + multifd; | |
44 | +} | |
45 | + | |
46 | bool migration_rate_exceeded(QEMUFile *f) | |
47 | { | |
48 | if (qemu_file_get_error(f)) { | |
49 | @@ -25,7 +39,7 @@ bool migration_rate_exceeded(QEMUFile *f) | |
50 | } | |
51 | ||
52 | uint64_t rate_limit_start = stat64_get(&mig_stats.rate_limit_start); | |
53 | - uint64_t rate_limit_current = migration_transferred_bytes(f); | |
54 | + uint64_t rate_limit_current = migration_transferred_bytes_noflush(f); | |
55 | uint64_t rate_limit_used = rate_limit_current - rate_limit_start; | |
56 | uint64_t rate_limit_max = stat64_get(&mig_stats.rate_limit_max); | |
57 |