exec: avoid unnecessary cacheline bounce on ram_list.mru_block

Whenever the MRU cache hits for the list of RAM blocks, qemu_get_ram_block
does an unnecessary write that causes a processor cache line to bounce
from one core to another. This causes a performance hit.

Backports commit 68851b98e5bf6d397498b74f1776801274ab8d48 from qemu
This commit is contained in:
Paolo Bonzini 2018-02-17 17:20:41 -05:00 committed by Lioncash
parent e1a4e4208f
commit 479f36ef8e
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -683,7 +683,7 @@ static RAMBlock *qemu_get_ram_block(struct uc_struct *uc, ram_addr_t addr)
/* The list is protected by the iothread lock here. */
block = uc->ram_list.mru_block;
if (block && addr - block->offset < block->max_length) {
goto found;
return block;
}
QTAILQ_FOREACH(block, &uc->ram_list.blocks, next) {
if (addr - block->offset < block->max_length) {