From: Xiao Guangrong <guangrong.xiao@gmail.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: pbonzini@redhat.com, mst@redhat.com, mtosatti@redhat.com,
kvm@vger.kernel.org, quintela@redhat.com,
Xiao Guangrong <xiaoguangrong@tencent.com>,
qemu-devel@nongnu.org, peterx@redhat.com, dgilbert@redhat.com,
wei.w.wang@intel.com, cota@braap.org,
Eric Blake <eblake@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/3] migration: introduce adaptive model for waiting thread
Date: Mon, 18 Feb 2019 16:47:06 +0800 [thread overview]
Message-ID: <d902d097-f706-4499-bcb0-8e8bc7fb4d08@gmail.com> (raw)
In-Reply-To: <87r2dj5xet.fsf@dusky.pond.sub.org>
On 1/11/19 5:57 PM, Markus Armbruster wrote:
> guangrong.xiao@gmail.com writes:
>
>> From: Xiao Guangrong <xiaoguangrong@tencent.com>
>>
>> Currently we have two behaviors if all threads are busy to do compression,
>> the main thread mush wait one of them becoming free if @compress-wait-thread
>> set to on or the main thread can directly return without wait and post
>> the page out as normal one
>>
>> Both of them have its profits and short-comes, however, if the bandwidth is
>> not limited extremely so that compression can not use out all of it bandwidth,
>> at the same time, the migration process is easily throttled if we posted too
>> may pages as normal pages. None of them can work properly under this case
>>
>> In order to use the bandwidth more effectively, we introduce the third
>> behavior, adaptive, which make the main thread wait if there is no bandwidth
>> left or let the page go out as normal page if there has enough bandwidth to
>> make sure the migration process will not be throttled
>>
>> Signed-off-by: Xiao Guangrong <xiaoguangrong@tencent.com>
>> ---
>> hmp.c | 6 ++-
>> migration/migration.c | 116 ++++++++++++++++++++++++++++++++++++++++++++------
>> migration/migration.h | 13 ++++++
>> migration/ram.c | 116 +++++++++++++++++++++++++++++++++++++++++++++-----
>> qapi/migration.json | 39 +++++++++++------
>
> You neglected to cc: the QAPI schema maintainers.
> scripts/get_maintainer.pl can help you find the maintainers to cc: on
> your patches.
>
Thank you for pointing it out, i will pay more attention on it.
>> 5 files changed, 251 insertions(+), 39 deletions(-)
> [...]
>> diff --git a/qapi/migration.json b/qapi/migration.json
>> index c5babd03b0..0220a0945b 100644
>> --- a/qapi/migration.json
>> +++ b/qapi/migration.json
>> @@ -93,11 +93,16 @@
>> #
>> # @compression-rate: rate of compressed size
>> #
>> +# @compress-no-wait-weight: it controls how many pages are directly posted
>> +# out as normal page when all compression threads are currently busy.
>> +# Only available if compress-wait-thread = adaptive. (Since 3.2)
>
> "Only available" suggests the member is optional.
>
>> +#
>> # Since: 3.1
>> ##
>> { 'struct': 'CompressionStats',
>> 'data': {'pages': 'int', 'busy': 'int', 'busy-rate': 'number',
>> - 'compressed-size': 'int', 'compression-rate': 'number' } }
>> + 'compressed-size': 'int', 'compression-rate': 'number',
>> + 'compress-no-wait-weight': 'int'} }
>
> It isn't. Should it be optional? If not, what's its value when
> compress-wait-thread isn't adaptive?
>
It'd be better to make it optional... i will fix it. :)
>>
>> ##
>> # @MigrationStatus:
>> @@ -489,9 +494,13 @@
>> # the compression thread count is an integer between 1 and 255.
>> #
>> # @compress-wait-thread: Controls behavior when all compression threads are
>> -# currently busy. If true (default), wait for a free
>> -# compression thread to become available; otherwise,
>> -# send the page uncompressed. (Since 3.1)
>> +# currently busy. If 'true/on' (default), wait for a free
>
>> +# compression thread to become available; if 'false/off', send the
>> +# page uncompressed. (Since 3.1)
>> +# If it is 'adaptive', the behavior is adaptively controlled based on
>> +# the rate limit. If it has enough bandwidth, it acts as
>> +# compress-wait-thread is off. (Since 3.2)
>> +#
>> #
>> # @decompress-threads: Set decompression thread count to be used in live
>> # migration, the decompression thread count is an integer between 1
>> @@ -577,9 +586,12 @@
>> # @compress-threads: compression thread count
>> #
>> # @compress-wait-thread: Controls behavior when all compression threads are
>> -# currently busy. If true (default), wait for a free
>> -# compression thread to become available; otherwise,
>> -# send the page uncompressed. (Since 3.1)
>> +# currently busy. If 'true/on' (default), wait for a free
>> +# compression thread to become available; if 'false/off', send the
>> +# page uncompressed. (Since 3.1)
>> +# If it is 'adaptive', the behavior is adaptively controlled based on
>> +# the rate limit. If it has enough bandwidth, it acts as
>> +# compress-wait-thread is off. (Since 3.2)
>> #
>> # @decompress-threads: decompression thread count
>> #
>> @@ -655,7 +667,7 @@
>> { 'struct': 'MigrateSetParameters',
>> 'data': { '*compress-level': 'int',
>> '*compress-threads': 'int',
>> - '*compress-wait-thread': 'bool',
>> + '*compress-wait-thread': 'str',
>
> Compatibility break.
>
> You can add a separate flag like you did in v1 if I understand your cover
> letter correctly. Awkward.
>
> You can use a suitable alternate of bool and enum.
‘alternate’ seems a good solution to me, will fix. :)
>
> 'str' is not a good idea, because it defeats introspection.
will fix.
>
>> '*decompress-threads': 'int',
>> '*cpu-throttle-initial': 'int',
>> '*cpu-throttle-increment': 'int',
>> @@ -697,9 +709,12 @@
>> # @compress-threads: compression thread count
>> #
>> # @compress-wait-thread: Controls behavior when all compression threads are
>> -# currently busy. If true (default), wait for a free
>> -# compression thread to become available; otherwise,
>> -# send the page uncompressed. (Since 3.1)
>> +# currently busy. If 'true/on' (default), wait for a free
>> +# compression thread to become available; if 'false/off', send the
>> +# page uncompressed. (Since 3.1)
>> +# If it is 'adaptive', the behavior is adaptively controlled based on
>> +# the rate limit. If it has enough bandwidth, it acts as
>> +# compress-wait-thread is off. (Since 3.2)
>> #
>> # @decompress-threads: decompression thread count
>> #
>> @@ -771,7 +786,7 @@
>> { 'struct': 'MigrationParameters',
>> 'data': { '*compress-level': 'uint8',
>> '*compress-threads': 'uint8',
>> - '*compress-wait-thread': 'bool',
>> + '*compress-wait-thread': 'str',
>
> Likewise.
will fix it too.
next prev parent reply other threads:[~2019-02-18 9:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-11 6:37 [Qemu-devel] [PATCH v2 0/3] optimize waiting for free thread to do compression guangrong.xiao
2019-01-11 6:37 ` [Qemu-devel] [PATCH v2 1/3] migration: introduce pages-per-second guangrong.xiao
2019-01-11 15:37 ` Eric Blake
2019-01-23 12:51 ` Dr. David Alan Gilbert
2019-01-23 12:34 ` Dr. David Alan Gilbert
2019-01-11 6:37 ` [Qemu-devel] [PATCH v2 2/3] migration: fix memory leak when updating tls-creds and tls-hostname guangrong.xiao
2019-01-15 7:51 ` Peter Xu
2019-01-15 10:24 ` Dr. David Alan Gilbert
2019-01-15 16:03 ` Eric Blake
2019-01-16 5:55 ` Peter Xu
2019-02-18 8:26 ` Xiao Guangrong
2019-01-11 6:37 ` [Qemu-devel] [PATCH v2 3/3] migration: introduce adaptive model for waiting thread guangrong.xiao
2019-01-11 9:57 ` Markus Armbruster
2019-02-18 8:47 ` Xiao Guangrong [this message]
2019-01-16 6:40 ` Peter Xu
2019-02-18 9:01 ` Xiao Guangrong
2019-01-11 9:53 ` [Qemu-devel] [PATCH v2 0/3] optimize waiting for free thread to do compression Markus Armbruster
2019-01-13 14:43 ` no-reply
2019-01-13 17:41 ` no-reply
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=d902d097-f706-4499-bcb0-8e8bc7fb4d08@gmail.com \
--to=guangrong.xiao@gmail.com \
--cc=armbru@redhat.com \
--cc=cota@braap.org \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=wei.w.wang@intel.com \
--cc=xiaoguangrong@tencent.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).