From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpEPB-0004Ph-PD for qemu-devel@nongnu.org; Thu, 22 Oct 2015 07:51:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZpEP7-0003Or-1V for qemu-devel@nongnu.org; Thu, 22 Oct 2015 07:51:37 -0400 From: Paolo Bonzini Date: Thu, 22 Oct 2015 13:51:30 +0200 Message-Id: <1445514690-7883-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH] exec: avoid unnecessary cacheline bounce on ram_list.mru_block List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, cota@braap.org 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 Signed-off-by: Paolo Bonzini --- 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