qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] exec: avoid unnecessary cacheline bounce on ram_list.mru_block
@ 2015-10-22 11:51 Paolo Bonzini
  2015-11-03 12:34 ` Michael Tokarev
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2015-10-22 11:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, cota

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>
---
 exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/exec.c b/exec.c
index 54cd70a..439b128 100644
--- a/exec.c
+++ b/exec.c
@@ -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) {
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] exec: avoid unnecessary cacheline bounce on ram_list.mru_block
  2015-10-22 11:51 [Qemu-devel] [PATCH] exec: avoid unnecessary cacheline bounce on ram_list.mru_block Paolo Bonzini
@ 2015-11-03 12:34 ` Michael Tokarev
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Tokarev @ 2015-11-03 12:34 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: qemu-trivial, cota

22.10.2015 14:51, Paolo Bonzini write:
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-03 12:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-22 11:51 [Qemu-devel] [PATCH] exec: avoid unnecessary cacheline bounce on ram_list.mru_block Paolo Bonzini
2015-11-03 12:34 ` Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).