qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] memory: add early bail out from cpu_physical_memory


From: Paolo Bonzini
Subject: [Qemu-devel] [PATCH] memory: add early bail out from cpu_physical_memory_set_dirty_range
Date: Tue, 26 Jan 2016 17:59:40 +0100

This condition is true in the common case, so we can cut out the body of
the function.  In addition, this makes it easier for the compiler to do
at least partial inlining, even if it decides that fully inlining the
function is unreasonable.

Signed-off-by: Paolo Bonzini <address@hidden>
---
 include/exec/ram_addr.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index ef1489d..6e31fb5 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -161,6 +161,10 @@ static inline void 
cpu_physical_memory_set_dirty_range(ram_addr_t start,
     unsigned long end, page;
     unsigned long **d = ram_list.dirty_memory;
 
+    if (!mask && !xen_enabled()) {
+        return;
+    }
+
     end = TARGET_PAGE_ALIGN(start + length) >> TARGET_PAGE_BITS;
     page = start >> TARGET_PAGE_BITS;
     if (likely(mask & (1 << DIRTY_MEMORY_MIGRATION))) {
-- 
2.5.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]