]> Git Repo - qemu.git/commitdiff
exec: avoid unnecessary cacheline bounce on ram_list.mru_block
authorPaolo Bonzini <[email protected]>
Thu, 22 Oct 2015 11:51:30 +0000 (13:51 +0200)
committerMichael Tokarev <[email protected]>
Fri, 6 Nov 2015 12:42:38 +0000 (15:42 +0300)
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 <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
exec.c

diff --git a/exec.c b/exec.c
index ed88e72f14e711750522a308a659ce84d1292e61..a0289615872ca3c026656c76f74441b30d33cbf8 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -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) {
This page took 0.026573 seconds and 4 git commands to generate.