qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	mtosatti@redhat.com,
	Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	drepper@redhat.com
Subject: [Qemu-devel] Re: [PATCH v2] qemu-kvm: Speed up of the dirty-bitmap-traveling
Date: Sun, 14 Feb 2010 14:34:10 +0200	[thread overview]
Message-ID: <4B77EDC2.7000401@redhat.com> (raw)
In-Reply-To: <4B74B70A.4030805@lab.ntt.co.jp>

On 02/12/2010 04:03 AM, OHMURA Kei wrote:
> On 02/11/2010 Anthony Liguori <anthony@codemonkey.ws> wrote:
>   
>> Oh, I see what's happening here. Yes, I think a leul_to_cpu() makes more
>> sense.
>>     
> Maybe I'm missing something here.
> I couldn't find leul_to_cpu(), so have defined it in bswap.h.
> Correct?
>
> --- a/bswap.h
> +++ b/bswap.h
> @@ -205,8 +205,10 @@ static inline void cpu_to_be32wu(uint32_t *p, uint32_t v)
>  
>  #ifdef HOST_WORDS_BIGENDIAN
>  #define cpu_to_32wu cpu_to_be32wu
> +#define leul_to_cpu(v) le ## HOST_LONG_BITS ## _to_cpu(v)
>  #else
>  #define cpu_to_32wu cpu_to_le32wu
> +#define leul_to_cpu(v) (v)
>  #endif
>
>
>
> On 02/10/2010 Ulrich Drepper <drepper@redhat.com> wrote:
>   
>> If you're optimizing this code you might want to do it all.  The
>> compiler might not see through the bswap call and create unnecessary
>> data dependencies.  Especially problematic if the bitmap is really
>> sparse.  Also, the outer test is != while the inner test is >.  Be
>> consistent.  I suggest to replace the inner loop with
>>
>>      do {
>>        ...
>>      } while (c != 0);
>>
>> Depending on how sparse the bitmap is populated this might reduce the
>> number of data dependencies quite a bit.
>>     
> Combining all comments, the code would be like this.
>      
>  if (bitmap_ul[i] != 0) {
>      c = leul_to_cpu(bitmap_ul[i]);
>      do {
>          j = ffsl(c) - 1;
>          c &= ~(1ul << j);
>          page_number = i * HOST_LONG_BITS + j;
>          addr1 = page_number * TARGET_PAGE_SIZE;
>          addr = offset + addr1;
>          ram_addr = cpu_get_physical_page_desc(addr);
>          cpu_physical_memory_set_dirty(ram_addr);
>      } while (c != 0);
>  }
>   

Except you don't need bitmap_ul any more - you can change the type of
the bitmap variable, since all accesses should now be ulongs.

-- 
error compiling committee.c: too many arguments to function

  reply	other threads:[~2010-02-14 12:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-10 10:52 [Qemu-devel] [PATCH v2] qemu-kvm: Speed up of the dirty-bitmap-traveling OHMURA Kei
2010-02-10 13:10 ` [Qemu-devel] " Ulrich Drepper
2010-02-10 13:20 ` Avi Kivity
2010-02-10 15:54   ` Anthony Liguori
2010-02-10 15:57     ` Avi Kivity
2010-02-10 16:00     ` Alexander Graf
2010-02-10 16:35       ` Anthony Liguori
2010-02-10 16:43         ` Alexander Graf
2010-02-10 16:46           ` Avi Kivity
2010-02-10 16:47             ` Alexander Graf
2010-02-10 16:52               ` Avi Kivity
2010-02-10 16:54                 ` Alexander Graf
2010-02-10 16:43         ` Avi Kivity
2010-02-10 15:55   ` Anthony Liguori
2010-02-12  2:03     ` OHMURA Kei
2010-02-14 12:34       ` Avi Kivity [this message]
2010-02-15  6:12         ` OHMURA Kei
2010-02-15  8:24           ` Alexander Graf
2010-02-16 11:16             ` OHMURA Kei
2010-02-16 11:18               ` Alexander Graf
2010-02-17  9:42                 ` OHMURA Kei
2010-02-17  9:46                   ` Alexander Graf
2010-02-18  5:57                     ` OHMURA Kei
2010-02-18 10:30                       ` Alexander Graf
2010-02-17  9:47                   ` Avi Kivity
2010-02-17  9:49                     ` Alexander Graf

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=4B77EDC2.7000401@redhat.com \
    --to=avi@redhat.com \
    --cc=drepper@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=ohmura.kei@lab.ntt.co.jp \
    --cc=qemu-devel@nongnu.org \
    --cc=tamura.yoshiaki@lab.ntt.co.jp \
    /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).