* [Qemu-devel] [PATCH] Speedup 'tb_find_slow' by using the same heuristic as during memory page lookup
@ 2010-12-02 13:12 Kirill Batuzov
2010-12-04 20:11 ` Blue Swirl
0 siblings, 1 reply; 4+ messages in thread
From: Kirill Batuzov @ 2010-12-02 13:12 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1051 bytes --]
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 <batuzovk@ispras.ru>
Signed-off-by: Pavel Yushchenko <pau@ispras.ru>
---
This patch appeared during investigation of performance issues with
S5PC110 emulation for Samsung. It increses OS startup speed significantly.
Changes from previous version, submitted with RFT tag:
- 'likely' was added to if condition,
- comment was added.
diff --git a/cpu-exec.c b/cpu-exec.c
index dbdfdcc..39e5eea 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -167,6 +167,12 @@ static TranslationBlock *tb_find_slow(target_ulong pc,
tb = tb_gen_code(env, pc, cs_base, flags, 0);
found:
+ /* Move the last found TB to the head of the list */
+ if (likely(*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;
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/x-diff; name=tb_find_slow-locality-heuristic.patch, Size: 589 bytes --]
diff --git a/cpu-exec.c b/cpu-exec.c
index dbdfdcc..39e5eea 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -167,6 +167,12 @@ static TranslationBlock *tb_find_slow(target_ulong pc,
tb = tb_gen_code(env, pc, cs_base, flags, 0);
found:
+ /* Move the last found TB to the head of the list */
+ if (likely(*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;
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [Qemu-devel] [PATCH] Speedup 'tb_find_slow' by using the same heuristic as during memory page lookup
2010-12-02 13:12 [Qemu-devel] [PATCH] Speedup 'tb_find_slow' by using the same heuristic as during memory page lookup Kirill Batuzov
@ 2010-12-04 20:11 ` Blue Swirl
2010-12-05 7:14 ` Kirill Batuzov
0 siblings, 1 reply; 4+ messages in thread
From: Blue Swirl @ 2010-12-04 20:11 UTC (permalink / raw)
To: Kirill Batuzov; +Cc: qemu-devel
On Thu, Dec 2, 2010 at 1:12 PM, Kirill Batuzov <batuzovk@ispras.ru> wrote:
> 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 <batuzovk@ispras.ru>
> Signed-off-by: Pavel Yushchenko <pau@ispras.ru>
> ---
>
> This patch appeared during investigation of performance issues with
> S5PC110 emulation for Samsung. It increses OS startup speed significantly.
The patch looks reasonable, but I didn't see any visible difference in
my tests. Could you report your numbers?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Speedup 'tb_find_slow' by using the same heuristic as during memory page lookup
2010-12-04 20:11 ` Blue Swirl
@ 2010-12-05 7:14 ` Kirill Batuzov
2010-12-05 8:22 ` Blue Swirl
0 siblings, 1 reply; 4+ messages in thread
From: Kirill Batuzov @ 2010-12-05 7:14 UTC (permalink / raw)
To: Blue Swirl; +Cc: qemu-devel
On 04.12.2010 23:11, Blue Swirl wrote:
> On Thu, Dec 2, 2010 at 1:12 PM, Kirill Batuzov<batuzovk@ispras.ru> wrote:
>> 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<batuzovk@ispras.ru>
>> Signed-off-by: Pavel Yushchenko<pau@ispras.ru>
>> ---
>>
>> This patch appeared during investigation of performance issues with
>> S5PC110 emulation for Samsung. It increses OS startup speed significantly.
>
> The patch looks reasonable, but I didn't see any visible difference in
> my tests. Could you report your numbers?
The exact numbers depend on complexity of guest system.
- For basic Debian system (no X-server) on versatilepb we observed 25%
decrease of boot time.
- For to-be released Samsung LIMO platform on S5PC110 board we
observed 2x (for older version) and 3x (for newer version) decrease of
boot time.
- Small CPU-intensive benchmarks are not affected because they are
completely handled by 'tb_find_fast'.
We also noticed better response time for heavyweight GUI applications,
but I do not know how to measure it accurately.
----
Kirill.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Speedup 'tb_find_slow' by using the same heuristic as during memory page lookup
2010-12-05 7:14 ` Kirill Batuzov
@ 2010-12-05 8:22 ` Blue Swirl
0 siblings, 0 replies; 4+ messages in thread
From: Blue Swirl @ 2010-12-05 8:22 UTC (permalink / raw)
To: Kirill Batuzov; +Cc: qemu-devel
On Sun, Dec 5, 2010 at 7:14 AM, Kirill Batuzov <batuzovk@ispras.ru> wrote:
> On 04.12.2010 23:11, Blue Swirl wrote:
>>
>> On Thu, Dec 2, 2010 at 1:12 PM, Kirill Batuzov<batuzovk@ispras.ru> wrote:
>>>
>>> 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<batuzovk@ispras.ru>
>>> Signed-off-by: Pavel Yushchenko<pau@ispras.ru>
>>> ---
>>>
>>> This patch appeared during investigation of performance issues with
>>> S5PC110 emulation for Samsung. It increses OS startup speed
>>> significantly.
>>
>> The patch looks reasonable, but I didn't see any visible difference in
>> my tests. Could you report your numbers?
>
> The exact numbers depend on complexity of guest system.
> - For basic Debian system (no X-server) on versatilepb we observed 25%
> decrease of boot time.
> - For to-be released Samsung LIMO platform on S5PC110 board we observed 2x
> (for older version) and 3x (for newer version) decrease of boot time.
> - Small CPU-intensive benchmarks are not affected because they are
> completely handled by 'tb_find_fast'.
>
> We also noticed better response time for heavyweight GUI applications, but I
> do not know how to measure it accurately.
OK. Thanks, applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-12-05 8:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-02 13:12 [Qemu-devel] [PATCH] Speedup 'tb_find_slow' by using the same heuristic as during memory page lookup Kirill Batuzov
2010-12-04 20:11 ` Blue Swirl
2010-12-05 7:14 ` Kirill Batuzov
2010-12-05 8:22 ` Blue Swirl
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.