aboutsummaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2016-02-20 10:35:20 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2016-02-25 16:11:29 +0100
commit3655cb9c7375a595a8051ec677c515b24d5c1fe6 (patch)
tree22578286292715ef50875e061141537aadb83f23 /memory.c
parent58eaa2174e99d9a05172d03fd2799ab8fd9e6f60 (diff)
memory: optimize qemu_get_ram_ptr and qemu_ram_ptr_length
these two functions consume too much cpu overhead to find the RAMBlock by ram address. After this patch, we can pass the RAMBlock pointer to them so that they don't need to find the RAMBlock anymore most of the time. We can get better performance in address translation processing. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Message-Id: <1455935721-8804-3-git-send-email-arei.gonglei@huawei.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/memory.c b/memory.c
index b4451dd2a5..0dd9695aec 100644
--- a/memory.c
+++ b/memory.c
@@ -1570,7 +1570,7 @@ void *memory_region_get_ram_ptr(MemoryRegion *mr)
mr = mr->alias;
}
assert(mr->ram_addr != RAM_ADDR_INVALID);
- ptr = qemu_get_ram_ptr(mr->ram_addr & TARGET_PAGE_MASK);
+ ptr = qemu_get_ram_ptr(mr->ram_block, mr->ram_addr & TARGET_PAGE_MASK);
rcu_read_unlock();
return ptr + offset;