Skip to contentSkip to conversation

exec: avoid unnecessary cacheline bounce on ram_list.mru_block

PATCH Applied Paolo Bonzini 2 participants 2 messages Oct 22, 2015 – Nov 3, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
exec.c +1 -1
index 54cd70a..439b128 100644
@@ -860,7 +860,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) {
Signature · 1 line
2.5.0
#1 lore raw

22.10.2015 14:51, Paolo Bonzini write:

Quoted 3 lines

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.

Applied to -trivial. A good one! :)

/mjt