From cbc56b3ceb346cb2b33ab49ffd6066590feff5c1 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 20 Feb 2018 08:31:58 -0500 Subject: [PATCH] memory: add early bail out from cpu_physical_memory_set_dirty_range 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. Backports commit 8bafcb21643a39a5b29109f8bd5ee5a6f0f6850b from qemu --- qemu/include/exec/ram_addr.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qemu/include/exec/ram_addr.h b/qemu/include/exec/ram_addr.h index 423abe13..4847e39d 100644 --- a/qemu/include/exec/ram_addr.h +++ b/qemu/include/exec/ram_addr.h @@ -108,6 +108,10 @@ static inline void cpu_physical_memory_set_dirty_range(struct uc_struct *uc, ram unsigned long end, page; unsigned long **d = uc->ram_list.dirty_memory; + if (!mask && !xen_enabled()) { + return; + } + end = TARGET_PAGE_ALIGN(start + length) >> TARGET_PAGE_BITS; page = start >> TARGET_PAGE_BITS; if (unlikely(mask & (1 << DIRTY_MEMORY_CODE))) {