qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: Andrei Gudkov <gudkov.andrei@huawei.com>
Cc: <qemu-devel@nongnu.org>,  <eblake@redhat.com>,
	 <armbru@redhat.com>, <berrange@redhat.com>,
	 <zhengchuan@huawei.com>
Subject: Re: [PATCH v2 3/4] migration/calc-dirty-rate: added n-zero-pages metric
Date: Wed, 10 May 2023 19:57:54 +0200	[thread overview]
Message-ID: <871qjo6pct.fsf@secure.mitica> (raw)
In-Reply-To: <ccdc82d8bdf6b4a0ccf49eec563db34e0dcf5e59.1682598010.git.gudkov.andrei@huawei.com> (Andrei Gudkov's message of "Thu, 27 Apr 2023 15:42:59 +0300")

Andrei Gudkov <gudkov.andrei@huawei.com> wrote:
> In sampling mode, a new metric is collected and reported:
> number of pages entirely filled with zeroes.

Good idea.

> @@ -331,11 +336,20 @@ static uint32_t compute_page_hash(void *ptr)
>      v2 = QEMU_XXHASH_SEED + XXH_PRIME64_2;
>      v3 = QEMU_XXHASH_SEED + 0;
>      v4 = QEMU_XXHASH_SEED - XXH_PRIME64_1;
> -    for (i = 0; i < TARGET_PAGE_SIZE / 8; i += 4) {
> -        v1 = XXH64_round(v1, p[i + 0]);
> -        v2 = XXH64_round(v2, p[i + 1]);
> -        v3 = XXH64_round(v3, p[i + 2]);
> -        v4 = XXH64_round(v4, p[i + 3]);
> +    if (ptr) {

It smells like a hack, that is only going to be used once in the
program.
But the only other option that I can think is repeating the function for
the zero case.

No way to win here.


> +        for (i = 0; i < TARGET_PAGE_SIZE / 8; i += 4) {
> +            v1 = XXH64_round(v1, p[i + 0]);
> +            v2 = XXH64_round(v2, p[i + 1]);
> +            v3 = XXH64_round(v3, p[i + 2]);
> +            v4 = XXH64_round(v4, p[i + 3]);
> +        }
> +    } else {
> +        for (i = 0; i < TARGET_PAGE_SIZE / 8; i += 4) {
> +            v1 = XXH64_round(v1, 0);
> +            v2 = XXH64_round(v2, 0);
> +            v3 = XXH64_round(v3, 0);
> +            v4 = XXH64_round(v4, 0);
> +        }

>      }
>      res = XXH64_mergerounds(v1, v2, v3, v4);
>      res += TARGET_PAGE_SIZE;
> @@ -343,6 +357,17 @@ static uint32_t compute_page_hash(void *ptr)
>      return (uint32_t)(res & UINT32_MAX);
>  }
>  
> +static uint32_t get_zero_page_hash(void)
> +{
> +    static uint32_t hash;
> +    static int is_computed;

bool?


Later, Juan.



  reply	other threads:[~2023-05-10 17:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-27 12:42 [PATCH v2 0/4] Migration time prediction using calc-dirty-rate Andrei Gudkov via
2023-04-27 12:42 ` [PATCH v2 1/4] migration/calc-dirty-rate: replaced CRC32 with xxHash Andrei Gudkov via
2023-05-10 16:54   ` Juan Quintela
2023-04-27 12:42 ` [PATCH v2 2/4] migration/calc-dirty-rate: detailed stats in sampling mode Andrei Gudkov via
2023-05-10 17:36   ` Juan Quintela
2023-05-12 13:18     ` gudkov.andrei--- via
2023-05-15  8:22       ` Juan Quintela
2023-05-18 14:45         ` gudkov.andrei--- via
2023-05-18 15:13           ` Juan Quintela
2023-05-15  8:23       ` Juan Quintela
2023-05-11  6:14   ` Markus Armbruster
2023-05-12 14:24     ` gudkov.andrei--- via
2023-05-30  3:06   ` Wang, Lei
2023-04-27 12:42 ` [PATCH v2 3/4] migration/calc-dirty-rate: added n-zero-pages metric Andrei Gudkov via
2023-05-10 17:57   ` Juan Quintela [this message]
2023-04-27 12:43 ` [PATCH v2 4/4] migration/calc-dirty-rate: tool to predict migration time Andrei Gudkov via
2023-05-10 18:01   ` Juan Quintela
2023-05-30  3:21   ` Wang, Lei
2023-06-02 13:06     ` gudkov.andrei--- via
2023-05-30 15:46 ` [PATCH v2 0/4] Migration time prediction using calc-dirty-rate Peter Xu
2023-05-31 14:46   ` gudkov.andrei--- via
2023-05-31 15:03     ` 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=871qjo6pct.fsf@secure.mitica \
    --to=quintela@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=gudkov.andrei@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --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 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).