From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, peterx@redhat.com
Subject: [Qemu-devel] [PATCH v3 3/4] memory: Refactor memory_region_clear_coalescing
Date: Tue, 20 Aug 2019 22:13:27 +0800 [thread overview]
Message-ID: <20190820141328.10009-4-peterx@redhat.com> (raw)
In-Reply-To: <20190820141328.10009-1-peterx@redhat.com>
Removing the update variable and quit earlier if the memory region has
no coalesced range. This prepares for the next patch.
Fixes: 3ac7d43a6fbb5d4a3
Signed-off-by: Peter Xu <peterx@redhat.com>
---
memory.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/memory.c b/memory.c
index 360e0cfa67..2f7a67086a 100644
--- a/memory.c
+++ b/memory.c
@@ -2283,7 +2283,10 @@ void memory_region_add_coalescing(MemoryRegion *mr,
void memory_region_clear_coalescing(MemoryRegion *mr)
{
CoalescedMemoryRange *cmr;
- bool updated = false;
+
+ if (QTAILQ_EMPTY(&mr->coalesced)) {
+ return;
+ }
qemu_flush_coalesced_mmio_buffer();
mr->flush_coalesced_mmio = false;
@@ -2292,12 +2295,9 @@ 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)
--
2.21.0
next prev parent reply other threads:[~2019-08-20 14:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-20 14:13 [Qemu-devel] [PATCH v3 0/4] memory: Fix up coalesced_io_del not working for KVM Peter Xu
2019-08-20 14:13 ` [Qemu-devel] [PATCH v3 1/4] memory: Split zones when do coalesced_io_del() Peter Xu
2019-08-20 14:13 ` [Qemu-devel] [PATCH v3 2/4] memory: Remove has_coalesced_range counter Peter Xu
2019-08-20 14:13 ` Peter Xu [this message]
2019-08-20 14:13 ` [Qemu-devel] [PATCH v3 4/4] memory: Fix up memory_region_{add|del}_coalescing Peter Xu
2019-08-21 8:14 ` [Qemu-devel] [PATCH v3 0/4] memory: Fix up coalesced_io_del not working for KVM Paolo Bonzini
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=20190820141328.10009-4-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).