Skip to content

Commit

Permalink
exec: avoid unnecessary cacheline bounce on ram_list.mru_block
Browse files Browse the repository at this point in the history
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.

Reported-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
bonzini authored and Michael Tokarev committed Nov 6, 2015
1 parent 74de807 commit 68851b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion exec.c
Expand Up @@ -903,7 +903,7 @@ static RAMBlock *qemu_get_ram_block(ram_addr_t addr)

block = atomic_rcu_read(&ram_list.mru_block);
if (block && addr - block->offset < block->max_length) {
goto found;
return block;
}
QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {
if (addr - block->offset < block->max_length) {
Expand Down

0 comments on commit 68851b9

Please sign in to comment.