mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
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>
This commit is contained in:
parent
58eaa2174e
commit
3655cb9c73
3 changed files with 31 additions and 21 deletions
2
memory.c
2
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue