qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH, RFT] Speedup 'tb_find_slow' by using the same heuri


From: Kirill Batuzov
Subject: [Qemu-devel] [PATCH, RFT] Speedup 'tb_find_slow' by using the same heuristic as during memory page lookup
Date: Mon, 22 Nov 2010 22:42:10 +0300
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101027 Lightning/1.0b2 Thunderbird/3.1.6

Move the last found TB to the head of the list so it will be found more quickly next time it will be looked for.

Signed-off-by: Kirill Batuzov <address@hidden>
Signed-off-by: Pavel Yushchenko <address@hidden>
---
Hello. This patch gives significant boost to a used by us rather rich (for embedded one - featuring X-server, many daemons and applications) ARM-based system literally decreasing its boot to desktop time by TWO times! (Average number of traversed 'tb_phys_hash' entries in the main loop of the 'tb_find_slow' function reduced from 20 to 1.5.) We were able to shorten boot to login time by about 25% as well using Debian on versatilepb (no X-server, only basic system). Seems like kernel booting time is not affected. No problems were encountered during our experiments.

We are looking forward for comments about this change and help with testing. Thanks in advance!

 cpu-exec.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/cpu-exec.c b/cpu-exec.c
index 5d6dd51..55c4526 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -161,6 +161,11 @@ static TranslationBlock *tb_find_slow(target_ulong pc,
     tb = tb_gen_code(env, pc, cs_base, flags, 0);

  found:
+    if (*ptb1) {
+        *ptb1 = tb->phys_hash_next;
+        tb->phys_hash_next = tb_phys_hash[h];
+        tb_phys_hash[h] = tb;
+    }
     /* we add the TB in the virtual pc hash table */
     env->tb_jmp_cache[tb_jmp_cache_hash_func(pc)] = tb;
     return tb;

Attachment: tb_find_slow-locality-heuristic.patch
Description: Source code patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]