All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Fam Zheng <famz@redhat.com>, qemu-devel@nongnu.org
Cc: stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] memory: Don't call memory_region_update_coalesced_range if nothing changed
Date: Fri, 13 Jun 2014 09:46:38 +0200	[thread overview]
Message-ID: <539AAC5E.7030808@redhat.com> (raw)
In-Reply-To: <1402641281-20382-1-git-send-email-famz@redhat.com>

Il 13/06/2014 08:34, Fam Zheng ha scritto:
> With huge number of PCI devices in the system (for example, 200
> virtio-blk-pci), this unconditional call can slow down emulation of
> irrelevant PCI operations drastically, such as a BAR update on a device
> that has no coalescing region. So avoid it.
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  memory.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/memory.c b/memory.c
> index d8ea212..57227f4 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -1324,6 +1324,7 @@ void memory_region_add_coalescing(MemoryRegion *mr,
>  void memory_region_clear_coalescing(MemoryRegion *mr)
>  {
>      CoalescedMemoryRange *cmr;
> +    bool updated = false;
>
>      qemu_flush_coalesced_mmio_buffer();
>      mr->flush_coalesced_mmio = false;
> @@ -1332,8 +1333,12 @@ void memory_region_clear_coalescing(MemoryRegion *mr)
>          cmr = QTAILQ_FIRST(&mr->coalesced);
>          QTAILQ_REMOVE(&mr->coalesced, cmr, link);
>          g_free(cmr);
> +        updated = true;
> +    }
> +
> +    if (updated) {
> +        memory_region_update_coalesced_range(mr);
>      }
> -    memory_region_update_coalesced_range(mr);
>  }
>
>  void memory_region_set_flush_coalesced(MemoryRegion *mr)
>

Very nice.  Applying to memory branch, thank you.

Paolo

      reply	other threads:[~2014-06-13  7:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-13  6:34 [Qemu-devel] [PATCH] memory: Don't call memory_region_update_coalesced_range if nothing changed Fam Zheng
2014-06-13  7:46 ` Paolo Bonzini [this message]

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=539AAC5E.7030808@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.