Skip to content

Commit

Permalink
qemu-timer: Skip empty timer lists before locking in qemu_clock_deadl…
Browse files Browse the repository at this point in the history
…ine_ns_all

This decreases qemu_clock_deadline_ns_all's share from 23.2% to 13% in a
profile of icount-enabled aarch64-softmmu.

Signed-off-by: Idan Horowitz <idan.horowitz@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220114004358.299534-2-idan.horowitz@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
IdanHo authored and rth7680 committed Jun 21, 2022
1 parent 18b8c47 commit 3f42906
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions util/qemu-timer.c
Expand Up @@ -261,6 +261,9 @@ int64_t qemu_clock_deadline_ns_all(QEMUClockType type, int attr_mask)
}

QLIST_FOREACH(timer_list, &clock->timerlists, list) {
if (!qatomic_read(&timer_list->active_timers)) {
continue;
}
qemu_mutex_lock(&timer_list->active_timers_lock);
ts = timer_list->active_timers;
/* Skip all external timers */
Expand Down

0 comments on commit 3f42906

Please sign in to comment.